public function first_or_new( array $attributes ) {

		$model = $this->where( $attributes )->first();

		if ( $model ) {
			return $model;
		}

		return new $this->model( (object) $attributes );
	}
public function first_or_new( array $attributes ) {

		$model = $this->where( $attributes )->first();

		if ( $model ) {
			return $model;
		}

		return new $this->model( (object) $attributes );
	}
public function first_or_new ( array $ attributes ) { $ model = $ this -> where ( $ attributes ) -> first ( ) ; if ( $ model ) { return $ model ; } return new $ this -> model ( ( object ) $ attributes ) ; }
Find the first model matching a given a set of attributes, or construct a new one.

The newly constructed model follows the fillable rules for the model.

@since 2.0

@param array $attributes

@return Model
Find the first model matching a given a set of attributes or construct a new one .