Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel PageController.php

<?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 :: creating default object from empty value laravel 
Php :: eloquent insert into select 
Php :: php input radio 
Php :: php value in array200 
Php :: wordpress login user programmatically 
Php :: php get first two paragraphs 
Php :: wordpress change slug programmatically 
Php :: laravel pagination 
Php :: laravel factory pass parameter 
Php :: match php 
Php :: simple pagination in php 
Php :: php sort by key 
Php :: laravel rate limit 
Php :: language_attributes for wordpress 
Php :: get page templete 
Php :: php return multiple values 
Php :: Laravel PackageManifest.php: Undefined index: name 
Php :: -sale_price 
Php :: cmd run php file 
Php :: Woocommerce Changing the Entry Title of the Custom Endpoint 
Php :: wordpress highlight text excerpt 
Php :: check if any values are the same in an array php 
Php :: Call to undefined method PsyUtilStr::random() 
Php :: PHP Parses a time string according to a specified format 
Php :: php set cookie for 5 second 
Php :: yii1 findall as array listData 
Php :: is search page wordpress dev 
Php :: how to fetch days old records php mysql 
Php :: wordpress add submenu under custom post type 
Php :: Full text search laravel mongodb 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =