Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

facing not found #143

Open
hassanshahzadaheer opened this issue Oct 28, 2021 · 6 comments
Open

facing not found #143

hassanshahzadaheer opened this issue Oct 28, 2021 · 6 comments

Comments

@hassanshahzadaheer
Copy link

hassanshahzadaheer commented Oct 28, 2021

Hi, where I'm wrong

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

I'm facing just 404

@thesunilyadav
Copy link

thesunilyadav commented Nov 1, 2021

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
Copy link
Author

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
Copy link

adrianmejias commented Nov 26, 2021

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
Copy link

codingstuff91 commented Dec 26, 2021

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
Copy 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 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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants