I have created the new controller using command line on laravel
php artisan make:controller PhotoController --resource
just display the string on a function of PhotoController like below
<?php
namespace AppHttpControllers;
use IlluminateHttpRequest;
class PhotoController extends Controller
{
/**
* Display a listing of the resource.
*
* @return IlluminateHttpResponse
*/
public function getName()
{
echo 'Dev';
}
Called the controller on route web.php
Route::get('photos', 'PhotoController@getName');
When i trying to load the url of controller
http://localhost/dev_laravel/public/photos
getting 404 Not found error
I also tried
http://localhost/dev_laravel/public/photo/
http://localhost/dev_laravel/public/photo/getname/
I’m beginner or learner for laravel and working on 5.8 version
php artisan route:list
after
Can anyone help me?
2
Answers
Open Terminal
and Run This Command
Open Second Terminal and run this command
And then Your url pattern is like
http://localhost:8000/photos
or
it gives a link like http://127.0.0.1:8000/ or your desire port if you set a port for it then just add photos like