In my web.php file, I created two routes :
Route::get('/{name}', 'PublicController@index')->name('welcome');
Route::get('stats', function () { return route('welcome', 'enrique'); });
My controller looks like:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PublicController extends Controller
{
public function index($name)
{
return view('welcome');
}
}
I already set up a virtual host in my local machine which is http://blog.test
When I Call http://blog.test/stats in my browser, it shows me the content of my homepage. But when I reorganize my twho route in web.php file in that way
Route::get('stats', function () { return route('welcome', 'enrique'); });
Route::get('/{name}', 'PublicController@index')->name('welcome');
It works fine.
Can you please explain why it behaves like that? Thanks
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SkD4ek
via IFTTT
Aucun commentaire:
Enregistrer un commentaire