nginx - Laravel showing blank page -
i setup laravel 5 framework in server typing in terminal
laravel new blog
(in "/var/www/html/" folder),
then changed default config of nginx root pointing : root /var/www/html/blog/public;
of-course files in place see blank page showing ! tried put html & php file in public folder , works fine. not laravel default index file. missing here ?
for adding pages in laravel not put files in /public
. please have @ official laravel page if want create new views.
laravel uses mvc principle. need have @ least view (the part displayed) , controller handles view. add new controller, please change project root cd /var/www/html/blog
, type in php artisan controller:make awesomecontroller
creates controller in app/http/controllers/awesomecontroller.php
.
in controller can return view adding return view('myview')
index()
method example. (the view has exist @ resources/views/myview.blade.php
of course)
in last step need tell laravel how call controller. please modify routes.php
file @ app/http/routes.php
, add route::get('foo', 'awesomecontroller');
. need tell composer of controllers may have changed , composer needs refresh cache. type in composer dump-autoload
, start development server php artisan serve
.
by calling http://localhost:8000/foo
(by default) should see view. have nice day!
Comments
Post a Comment