firstOrNew() public method

Get the first record matching the attributes or instantiate it.
public firstOrNew ( array $attributes, array $values = [] ) : Model
$attributes array
$values array
return Model
Example #1
0
 /**
  * Get the first record matching the attributes or instantiate it.
  *
  * @param array $attributes
  * @return \Illuminate\Database\Eloquent\Model 
  * @static 
  */
 public static function firstOrNew($attributes)
 {
     return \Illuminate\Database\Eloquent\Builder::firstOrNew($attributes);
 }
Example #2
0
 /**
  * @param array $attributes
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function firstOrNew(array $attributes)
 {
     return parent::firstOrNew($attributes);
 }