public function firstOrCreate(array $attributes = [])
    {
        $model = $this->first();
        if (!$model) {
            $model = $this->create($attributes);
        }
        return $model;
    }
public function firstOrCreate(array $attributes = [])
    {
        $model = $this->first();
        if (!$model) {
            $model = $this->create($attributes);
        }
        return $model;
    }
public function firstOrCreate ( array $ attributes = [ ] ) { $ model = $ this -> first ( ) ; if ( ! $ model ) { $ model = $ this -> create ( $ attributes ) ; } return $ model ; }
Find first or create record.

@param array $attributes additional attributes to create the record with.
@return object
Find first or create record .