public function find($constraints, $columns = '*', ...$loaders)
    {
    	if (! is_array($constraints)) {
            $constraints = ['id' => $constraints];
        }

        //We fetch the user using a given constraint.
        $model = $this->getModel()->select($columns)->where($constraints)->get();

        //We throw an exception if the user was not found to avoid whether
        //somebody tries to look for a non-existent user.
        abort_if( ! $model, 404);

        //If loaders were requested, we will lazy load them.
        if (count($loaders) > 0) {
            $model->load(implode(',', $loaders));
        }

        return $model;
    }
public function find($constraints, $columns = '*', ...$loaders)
    {
    	if (! is_array($constraints)) {
            $constraints = ['id' => $constraints];
        }

        //We fetch the user using a given constraint.
        $model = $this->getModel()->select($columns)->where($constraints)->get();

        //We throw an exception if the user was not found to avoid whether
        //somebody tries to look for a non-existent user.
        abort_if( ! $model, 404);

        //If loaders were requested, we will lazy load them.
        if (count($loaders) > 0) {
            $model->load(implode(',', $loaders));
        }

        return $model;
    }
public function find ( $ constraints , $ columns = '*' , ... $ loaders ) { if ( ! is_array ( $ constraints ) ) { $ constraints = [ 'id' => $ constraints ] ; } //We fetch the user using a given constraint. $ model = $ this -> getModel ( ) -> select ( $ columns ) -> where ( $ constraints ) -> get ( ) ; //We throw an exception if the user was not found to avoid whether //somebody tries to look for a non-existent user. abort_if ( ! $ model , 404 ) ; //If loaders were requested, we will lazy load them. if ( count ( $ loaders ) > 0 ) { $ model -> load ( implode ( ',' , $ loaders ) ) ; } return $ model ; }
Find a Model in the Database using the given constraints.

@param mixed $constraints
@param mixed $columns
@param array $loaders

@return \Illuminate\Database\Eloquent\Model|null
Find a Model in the Database using the given constraints .