Open hassanshahzadaheer opened 3 years ago
Hello @hassanshahzadaheer
// Task 3: point the GET URL "/about" to the view // resources/views/pages/about.blade.php - without any controller // Also, assign the route name "about" // Put one code line here below
The answer of above task is like below :
Route::get('/about',function(){ return view('pages.about');})->name('about');
The task is to call /about
url which will return the view named about
, located inside the pages
directory in the views directory.
Your mistake is regarding url
and view path
.
Now face this
Symfony\Component\Routing\Exception\RouteNotFoundException
Route [dashboard] not defined. (View: /home/aheer/Documents/Laravel-projects/Test-Laravel-Routes/resources/views/layouts/navigation.blade.php)
http://127.0.0.1:8000/about
Now face this
Symfony\Component\Routing\Exception\RouteNotFoundException Route [dashboard] not defined. (View: /home/aheer/Documents/Laravel-projects/Test-Laravel-Routes/resources/views/layouts/navigation.blade.php) http://127.0.0.1:8000/about
I would complete the route test changes and then run unit tests. The unit tests opens a sort of "browser" without you having to manually do so. Task 7 will show you the answer for the dashboard route not being defined.
Hello @hassanshahzadaheer
// Task 3: point the GET URL "/about" to the view // resources/views/pages/about.blade.php - without any controller // Also, assign the route name "about" // Put one code line here below
The answer of above task is like below :
Route::get('/about',function(){ return view('pages.about');})->name('about');
The task is to call
/about
url which will return the view namedabout
, located inside thepages
directory in the views directory. Your mistake is regardingurl
and viewpath
.
For this question, you have another correct answer.
When you want to create a route that only calls a view you can use a "view" route like this : Route::view('/about', 'pages.about')->name('about');
Read the documentation here : LINK
Hello @hassanshahzadaheer
// Task 3: point the GET URL "/about" to the view // resources/views/pages/about.blade.php - without any controller // Also, assign the route name "about" // Put one code line here below
The answer of above task is like below :
Route::get('/about',function(){ return view('pages.about');})->name('about');
The task is to call
/about
url which will return the view namedabout
, located inside thepages
directory in the views directory. Your mistake is regardingurl
and viewpath
.
i think you should use the Route::view($url, $fileDirectory)
Hi, where I'm wrong
Route::get('pages/about',function () { return view('about'); })->name(name:'about');
I'm facing just 404
I think the name function should be Route::view('/about', 'pages.about')->name('unique_name_of_the_route')
Hi, where I'm wrong
I'm facing just 404