LaravelDaily / Test-Laravel-Routes

134 stars 1.08k forks source link

facing not found #143

Open hassanshahzadaheer opened 3 years ago

hassanshahzadaheer commented 3 years ago

Hi, where I'm wrong

Route::get('pages/about',function () {
  return view('about');
})->name(name:'about');

I'm facing just 404

thesunilyadav commented 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.

hassanshahzadaheer commented 2 years ago

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
adrianmejias commented 2 years ago

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.

codingstuff91 commented 2 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.

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

Jacreator commented 2 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.

i think you should use the Route::view($url, $fileDirectory)

Jacreator commented 2 years ago

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')