Reputation: 1055
I just tried loading a view using a route like so:
route.php
Route::get("/page", function(){
return View::make("dir.page");
});
controller.php
View::make("/page");
...and an error was thrown. So my question is:
Is it possible to load a route via a view and if its possible then how?
Thanks.
Upvotes: 16
Views: 59377
Reputation: 5776
This works in Laravel 7:
Route::get("/page", function(){
return view("dir.page");
});
Upvotes: 3
Reputation: 5602
In laravel 5.8 I had to use this.
Route::get("/page", function(){
return \View::make("dir.page");
});
Upvotes: 0
Reputation: 454
Your should return
your View.
So this will work fine:
Route::get("/page", function(){
return View::make("dir.page");
});
Upvotes: 14