×
          
              
          
      
      Clear all filters including search bar
          
        Valeri Tandilashvili's Personal Professional Blog
      
    paginatepublic function index()
{
    $posts = Post::orderBy('title', 'asc')->paginate(1);
    return $posts;
}{{$posts->links()}}if there are less records then per page, pagination will not appearpublic function index()
{
    $posts = DB::select('SELECT * FROM posts');
    return view('posts.index')->with('posts', $posts);
}DBuse DB;wherepublic function index()
{
    $posts = Post::where('title', 'pst')->get();
    return view('posts.index')->with('posts', $posts);
}title$posts = Post::orderBy('title', 'asc')->get();
return view('posts.index')->with('posts', $posts);$posts = Post::All();
return view('posts.index')->with('posts', $posts);trueclass Post extends Model
{
    // Timestamps
    public $timestamps = false;
}idclass Post extends Model
{
    // Primary key
    public $primaryKey = 'record_id';
}postsclass Post extends Model
{
    // Table Name
    protected $table = 't_posts';
}echo App\Post::count();posts$post = new App\Post();
$post->title = 'the post title';
$post->content = 'the post body';
$post->save();$post->delete();php artisan tinker