src/Block.php
public function display($category)
    {

        $view = (View::exists("block::{$category}")) ? "block::{$category}" : "block::default";
        
        $category = $this->category
            ->scopeQuery(function ($query) use ($category) {
                return $query->with('blocks')->whereSlug($category);
            })->first();

        $blocks = $category->blocks;
        return view($view, compact('blocks', 'category'))->render();
    }
public function display($category)
    {

        $view = (View::exists("block::{$category}")) ? "block::{$category}" : "block::default";
        
        $category = $this->category
            ->scopeQuery(function ($query) use ($category) {
                return $query->with('blocks')->whereSlug($category);
            })->first();

        $blocks = $category->blocks;
        return view($view, compact('blocks', 'category'))->render();
    }
public function display ( $ category ) { $ view = ( View :: exists ( "block::{$category}" ) ) ? "block::{$category}" : "block::default" ; $ category = $ this -> category -> scopeQuery ( function ( $ query ) use ( $ category ) { return $ query -> with ( 'blocks' ) -> whereSlug ( $ category ) ; } ) -> first ( ) ; $ blocks = $ category -> blocks ; return view ( $ view , compact ( 'blocks' , 'category' ) ) -> render ( ) ; }
take latest blocks for public side
@param type $count
@param type|string $view
@return type
take latest blocks for public side