firstOrCreate() public static method

Get the first record matching the attributes or create it.
public static firstOrCreate ( array $attributes ) : Model
$attributes array
return Illuminate\Database\Eloquent\Model
Example #1
0
 /**
  * Overrided firstOrCreate method of Model to trim data
  *
  * @return object
  */
 public static function firstOrCreate(array $data = array())
 {
     $trimedData = self::trimData($data);
     return parent::firstOrCreate($trimedData);
 }