I'm currently dealing with Image Upload in Laravel-5.3. My "profile page" routes are defined as:
/* GET request to show the profile page */
Route::get('/{username}', [
'uses' => '\App\Http\Controllers\ProfileController@getProfile',
'as' => 'profile.index',
]);
/* POST request to update the Avatar (display pic) */
Route::post('/{username}', [
'uses' => '\App\Http\Controllers\ProfileController@updateAvatar',
'as' => 'profile.index',
]);
Thus, the profile URL pretty much looks like example.com/john (let "john" be the username)
In the form though, I have to define the "action".
<form enctype="multipart/form-data" action="" method="POST">
How can I define the route in the form action so that the users are redirected to their own respective routes; something like " example.com/john ".
I guess I can't directly define <form action="/{username}"> as I'll be taken to http://ift.tt/2f1G9QU} instead.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire