src/Versatile/Query/Builder.php
public function firstOrFail($columns = array('*'))
    {

        $columnsPassed = (func_num_args() > 1);

        $columns = $columnsPassed ? $columns : $this->getQueryColumns();

        $query = $this->buildQuery($columns);

        if ($columnsPassed) {
            return $query->firstOrFail($columns);
        }

        // addJoinOnce adds queryColumns again...
        return $query->firstOrFail($this->getQueryColumns());

    }
public function firstOrFail($columns = array('*'))
    {

        $columnsPassed = (func_num_args() > 1);

        $columns = $columnsPassed ? $columns : $this->getQueryColumns();

        $query = $this->buildQuery($columns);

        if ($columnsPassed) {
            return $query->firstOrFail($columns);
        }

        // addJoinOnce adds queryColumns again...
        return $query->firstOrFail($this->getQueryColumns());

    }
public function firstOrFail ( $ columns = array ( '*' ) ) { $ columnsPassed = ( func_num_args ( ) > 1 ) ; $ columns = $ columnsPassed ? $ columns : $ this -> getQueryColumns ( ) ; $ query = $ this -> buildQuery ( $ columns ) ; if ( $ columnsPassed ) { return $ query -> firstOrFail ( $ columns ) ; } // addJoinOnce adds queryColumns again... return $ query -> firstOrFail ( $ this -> getQueryColumns ( ) ) ; }
Execute the query and get the first result or throw an exception.

@param  array  $columns
@return \Illuminate\Database\Eloquent\Model|static

@throws \Illuminate\Database\Eloquent\ModelNotFoundException
Execute the query and get the first result or throw an exception .