https://laravel.com/docs/5.4/routing
All Laravel routes are defined in your route files, which are located in the `routes` directory.
For most applications, you will begin by defining routes in your `routes/web.php` file.
The `routes/web.php` file defines routes that are for your web interface.
These routes are assigned the web middleware group,
which provides features like session state and CSRF protection.
In this tutorial you will make some Route::get() calls with different arguments in the `routes/web.php` file.
Laravel::problem => view('welcome'); vs View::make('welcome')
Route::get('/', function () {
return view('welcome');
});
Route::get('about', function () {
return 'About content goes here. Route 1';
});
Route::get('about/directions', function () {
return 'Directions content go here. Route 2';
});
Route::get('about/{theSubject}', function ($theSubject) {
return $theSubject . ' content goes here. Route 3';
});
Route::get('about/classes/{theSubject}', function ($theSubject) {
return "Content of {$theSubject} class goes here. Route 4";
});
Route::get('about/{name?}', function ($name = 'John') {
return "Passed name was: $name Route para";
});
To see and try this code open: http://localhost:8000/
1. Handling routing
Slide 2
Views are stored in the path: `resources/views`
You will find the view file `welcome.blade.php`
This is the view file that you have noticed called in `routes/web.php`.
Route::get('/', function () {
return view('welcome');
});
And this is the main webpage view that you see when you access: http://localhost:8000/
- - - - - - - - - -
We will add a CSS file, this file will be linked to from `welcome.blade.php`
Go to `public/css`
Create a new CSS file named for example `main.css`
Now go to `welcome.blade.php` and in the <head> section add this line:<link rel="stylesheet" href="<?php echo asset('css/main.css'); ?>" type="text/css" >
Try and use any CSS rules in the view `welcome.blade.php` to see if it works.
Note that asset('css/main.css'); does not mention `public` folder,
and that is because asset() targets the `public` folder by default.
You can use asset() to link to JavaScript files, images, or any other assets into your Laravel view
as long as those assets are in the `public` folder.