public function find_or_fail( $primary_key ) {

		$result = $this->find( $primary_key );

		if ( is_array( $primary_key ) ) {
			if ( count( $result ) == count( array_unique( $primary_key ) ) ) {
				return $result;
			}
		} elseif ( $result ) {
			return $result;
		}

		throw new ModelNotFoundException( "No model found for '$primary_key'." );
	}
public function find_or_fail( $primary_key ) {

		$result = $this->find( $primary_key );

		if ( is_array( $primary_key ) ) {
			if ( count( $result ) == count( array_unique( $primary_key ) ) ) {
				return $result;
			}
		} elseif ( $result ) {
			return $result;
		}

		throw new ModelNotFoundException( "No model found for '$primary_key'." );
	}
public function find_or_fail ( $ primary_key ) { $ result = $ this -> find ( $ primary_key ) ; if ( is_array ( $ primary_key ) ) { if ( count ( $ result ) == count ( array_unique ( $ primary_key ) ) ) { return $ result ; } } elseif ( $ result ) { return $ result ; } throw new ModelNotFoundException ( "No model found for '$primary_key'." ) ; }
Find a model by its primary key or throw an exception.

@since 2.0

@param string|int|array $primary_key

@return Model|Collection

@throws ModelNotFoundException
Find a model by its primary key or throw an exception .