×
Clear all filters including search bar
Valeri Tandilashvili's Personal Professional Blog
php artisan servenpm run watchnpm run devpublic/css/ folder<link href="{{asset('css/app.css')}}" rel="stylesheet">public function about() {
$param1 = 'this is a parameter of about us page';
return view('pages/about', compact('param1'));
}
Content of about blade (the page receives and uses the passed parameter)@section('cntnt')
<h3>abt us {{$param1}}</h3>
@endsectionresurces/views/layouts/app.blade.php @extends('layouts.app')
@section('content')
// "about us" page content goes here
@endsection@yield is mainly used to define a section in a layout.
Content of resources/views/layouts/app.blade.php file<body>
@yield('content')
</body>
Content of about page that extends the above layout file@extends('layouts.app')
@section('content')
// "about us" page content goes here
@endsectionabout returns view from route. Other routes fire PagesController appropriate methodsRoute::get('/', 'PagesController@index');
Route::get('/about', function () {
return view('pages.about');
});
Route::get('/services', 'PagesController@services');
Route::get('/contact', 'PagesController@contactUs');
PagesController methodsclass PagesController extends Controller
{
public function index() {
return view('pages.index');
}
public function about() {
return view('pages/about');
}
public function services() {
return view('pages/services');
}
public function contactUs() {
return 'Under Construction';
}
}Route::get('/users/{name}', function ($name) {
return 'This is a user ' . $name;
});
Two parameters passed through the request URLRoute::get('/users/{name}/{id}', function ($name, $id) {
return 'This is a user ' . $name .' with an id of '. $id;
});resources/views/pages/about.blade.php Route::get('/hello', function () {
return view('pages/about');
});
pages/about is the same as pages.about