-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Add support for disallowing class morphs (#38656)
* Add support for disallowing class morphs and thus requiring morph maps * move method * formatting - add method Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
- Loading branch information
1 parent
fd21789
commit 4b5060d
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database; | ||
|
||
use RuntimeException; | ||
|
||
class ClassMorphViolationException extends RuntimeException | ||
{ | ||
/** | ||
* The name of the affected Eloquent model. | ||
* | ||
* @var string | ||
*/ | ||
public $model; | ||
|
||
/** | ||
* Create a new exception instance. | ||
* | ||
* @param object $model | ||
*/ | ||
public function __construct($model) | ||
{ | ||
$class = get_class($model); | ||
|
||
parent::__construct("No morph map defined for model [{$class}]."); | ||
|
||
$this->model = $class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters