public function scopeFilteredByStatus(Builder $query, $status = null)
    {
        $status = is_null($status) ? request('f', 'all') : $status;

        if (in_array($status, ['published', 'withheld', 'draft', 'pending', 'archived', 'invisible', 'locked']))
        {
            $query->{$status}();
        }

        return $query;
    }
public function scopeFilteredByStatus(Builder $query, $status = null)
    {
        $status = is_null($status) ? request('f', 'all') : $status;

        if (in_array($status, ['published', 'withheld', 'draft', 'pending', 'archived', 'invisible', 'locked']))
        {
            $query->{$status}();
        }

        return $query;
    }
public function scopeFilteredByStatus ( Builder $ query , $ status = null ) { $ status = is_null ( $ status ) ? request ( 'f' , 'all' ) : $ status ; if ( in_array ( $ status , [ 'published' , 'withheld' , 'draft' , 'pending' , 'archived' , 'invisible' , 'locked' ] ) ) { $ query -> { $ status } ( ) ; } return $ query ; }
Status filter scope

@param Builder $query
@param string $status
@return Builder
Status filter scope