Question: Laravel- view is not working

Question

Laravel- view is not working

Answers 2
Added at 2016-12-31 08:12
Tags
Question

I am using Ubuntu 16.04 and installed Laravel 5.3 on desktop/Laravel/test directory. I have created a test.blade.php file in resources/view directory. I have also created routes.php in app/Http directory and added following code:

Route::get('/', function(){
    return view('test');
});

When I enter command in terminal: php artisan serve and go to http://localhost:8000 url in browser, it shows default page of laravel after installation. Why it is not showing view I have created? I have also tried writing following code in routes.php:

Route::get('/', function(){
    echo "Test";
})

But still it doesn't work. Is there anything I am missing?

Answers to

Laravel- view is not working

nr: #1 dodano: 2016-12-31 08:12

Reference

By default, fresh Laravel 5.3 applications contain two HTTP route files in a new top-level routes directory. The web and api route files provide more explicit guidance in how to split the routes for your web interface and your API.

The routes.php is moved to different folder in Laravel 5.3. Update routes/web.php file.

nr: #2 dodano: 2016-12-31 09:12

From the Laravel Documentation 5.3 The routes directory contains all of the route definitions for your application. By default, three route files are included with Laravel: web.php, api.php, and console.php.

The routes.php was there in previous version. But in laravel 5.3 the routes.php is moved to routes/web.php as Saumini Navaratnam said.

Source Show
◀ Wstecz