public function findByComponentName($name = null)
    {
        return $this->model->with('component', 'priority', 'brand', 'jobs')->whereHas('component', function($q) use($name) {
                    $q->where('active', 1);
                    if (!is_null($name)) {
                        $q->where('name', $name);
                    }
                })->where('brand_id', brand_id());
    }
public function findByComponentName($name = null)
    {
        return $this->model->with('component', 'priority', 'brand', 'jobs')->whereHas('component', function($q) use($name) {
                    $q->where('active', 1);
                    if (!is_null($name)) {
                        $q->where('name', $name);
                    }
                })->where('brand_id', brand_id());
    }
public function findByComponentName ( $ name = null ) { return $ this -> model -> with ( 'component' , 'priority' , 'brand' , 'jobs' ) -> whereHas ( 'component' , function ( $ q ) use ( $ name ) { $ q -> where ( 'active' , 1 ) ; if ( ! is_null ( $ name ) ) { $ q -> where ( 'name' , $ name ) ; } } ) -> where ( 'brand_id' , brand_id ( ) ) ; }
find rows by component type name

@param String $name
@return \Illuminate\Database\Eloquent\Builder
find rows by component type name