Search
 
SCRIPT & CODE EXAMPLE
 

PHP

firstOrfail()

<?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 :: disable sidebar widget wordpress 5.8 
Php :: Drupal 8 custom form image field 
Php :: if statement in laravel blade 
Php :: php file_get_contents html with special characters 
Php :: laravel collection to array 
Php :: php array current 
Php :: laravel collection when 
Php :: how to get length array in php 
Php :: php method type hinting 
Php :: laravel edit form modal example 
Php :: PHP rtrim — Strip whitespace (or other characters) from the end of a string 
Php :: cakephp login session 
Php :: using get in laravel blade 
Php :: laravel form request exists 
Php :: how to extract data from json in php 
Php :: how to start the index from 1 in php? 
Php :: laravel migration change column order 
Php :: php strict mopde 
Php :: laravel migration text length 
Php :: laravel https middleware 
Php :: laravel select only one word from string 
Php :: Convert an Array to a String in PHP 
Php :: storefront remove sidebar from product page 
Php :: Laravel Nested whenLoaded 
Php :: unnamed place placeholders pdo 
Php :: php md5 password is insecure 
Php :: laravel getClientOriginalExtension 
Php :: date in russian php 
Php :: check date is in the last 24 hours? 
Php :: Error : Call to undefined method IlluminateNotificationsChannelsMailChannel::assertSentTo() 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =