We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
setModel()
1 parent 86ede87 commit 4e3e11aCopy full SHA for 4e3e11a
src/Builder/ExtractBuilder.php
@@ -2,7 +2,9 @@
2
3
namespace NaimSolong\DataExtractor\Builder;
4
5
+use Exception;
6
use Illuminate\Database\DatabaseManager;
7
+use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Support\Collection;
9
use InvalidArgumentException;
10
use RuntimeException;
@@ -65,6 +67,10 @@ public function getModel(): mixed
65
67
*/
66
68
public function setModel(mixed $model): self
69
{
70
+ if (! is_subclass_of($model, Model::class)) {
71
+ throw new Exception('The provided model, parent must be an instance of Illuminate\Database\Eloquent\Model');
72
+ }
73
+
74
$this->model = $model;
75
76
return $this;
0 commit comments