×
Clear all filters including search bar
Valeri Tandilashvili's Laravel Notes
posts
)class Post extends Model
{
// Table Name
protected $table = 't_posts';
}
echo App\Post::count();
Creates new post in posts
table using tinker from terminal$post = new App\Post();
$post->title = 'the post title';
$post->content = 'the post body';
$post->save();
Deletes the newly created post$post->delete();
php artisan tinker
php artisan serve
npm run watch
npm run dev
public/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>
@endsection
resurces/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
@endsection