Skip to content

Commit

Permalink
Improve findOrFail() exceptions (#26182)
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir authored and taylorotwell committed Oct 19, 2018
1 parent 20fca27 commit 442c5ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public function findOrFail($id, $columns = ['*'])
return $result;
}

throw (new ModelNotFoundException)->setModel(get_class($this->related));
throw (new ModelNotFoundException)->setModel(get_class($this->related), $id);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function findOrFail($id, $columns = ['*'])
return $result;
}

throw (new ModelNotFoundException)->setModel(get_class($this->related));
throw (new ModelNotFoundException)->setModel(get_class($this->related), $id);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function testFirstOrFailThrowsAnException()

/**
* @expectedException \Illuminate\Database\Eloquent\ModelNotFoundException
* @expectedExceptionMessage No query results for model [Illuminate\Tests\Database\HasManyThroughTestPost].
* @expectedExceptionMessage No query results for model [Illuminate\Tests\Database\HasManyThroughTestPost] 1
*/
public function testFindOrFailThrowsAnException()
{
Expand Down

0 comments on commit 442c5ee

Please sign in to comment.