Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel display category post by slug

Route::get(/category/{slug});

    public function postCategory($slug)
    {
        $posts = Post::where('slug', $slug)->get();

        return view('front.posts.category', compact('posts'));
    }
Comment

laravel display category post by slug

    public function postCategory($id)
    {
        $posts = Post::where('category_id', $id)->get();

        return view('front.posts.category', compact('posts'));
    }
Comment

PREVIOUS NEXT
Code Example
Php :: php post not working 
Php :: array_push php 
Php :: laravel get last created id 
Php :: htaccess after trailing slash page return status 200 
Php :: php strftime year 2 digits 
Php :: return pdft download and back with msg in laravel 
Php :: Fetch pivot data laravel 
Php :: workpress change page title from shortcode 
Php :: php array sort 
Php :: laravel collection take 
Php :: difference between array_merge and + 
Php :: how to add image in wordpress theme 
Php :: PHP substr — Return part of a string 
Php :: wordpress shortcode api 
Php :: bool value of blank string inp php 
Php :: the plugin generated 14 characters of unexpected output during activation. if you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin 
Php :: PHP XML Expat Parser 
Php :: optional parameter in laravel 
Php :: laravel stack script 
Php :: unravel_index numpy 
Php :: PHPDoc @method 
Php :: ModelNotFoundException 
Php :: route list laravel 8 
Php :: laravel package development 
Php :: laravel routing 
Php :: php class extends two classes 
Php :: php run command windows 
Php :: check if is the last day of the month php 
Php :: Array (key and value) 
Php :: upload image to mysqli database 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =