Search
 
SCRIPT & CODE EXAMPLE
 

PHP

::latest()

<?php

namespace AppHttpControllers;

use AppModelsPost;
use IlluminateHttpRequest;

class PageController extends Controller
{
    //
    public function index(){

        $posts = Post::latest("id")->get();
        return view("index",["posts"=>$posts]);//compact($posts)
    }

    public function detail($slug){
        $post = Post::where("slug",$slug)->firstOrfail();
        return  view('post.detail',compact('post'));
        return $slug;
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: types of method in api 
Php :: mysql_real_escape_string 
Php :: php echo html and variable 
Php :: Laravel Migrations from an existing database 
Php :: php my admin on linux 
Php :: How to Auto Backup Mysql Database Using PHP Script 
Php :: laravel create table if not exists 
Php :: php configuration in apache server 2.4 
Php :: laravel 8 resource 
Php :: sum two numbers in php 
Php :: how to loop by index in php 
Php :: laravel store blob image into database 
Php :: laravel_login 
Php :: convert html to pdf using php.php 
Php :: php check for duplicates in array 
Php :: laravel validate change password 
Php :: twig in array 
Php :: js php number format space 
Php :: laravel migration int length 
Php :: php ErrorException Undefined variable inside array_map 
Php :: sqlstate[22023]: invalid parameter value: 
Php :: swagger laravel 
Php :: mixed content laravel form target 
Php :: jwt return true 
Php :: like query with prepare wordpress 
Php :: php estrutura basica 
Php :: debug bar laravel print array 
Php :: find in associative array php by property value 
Php :: laravel install 
Php :: pre_get_posts order by title 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =