Skip to content

Commit 97c3bd9

Browse files
author
Sébastien Nikolaou
committed
Declare types in EloquentDatatable contructor and remove exception
1 parent f83c9ca commit 97c3bd9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/EloquentDataTable.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ class EloquentDataTable extends QueryDataTable
2020
/**
2121
* EloquentEngine constructor.
2222
*
23-
* @param \Illuminate\Database\Eloquent\Model|EloquentBuilder $model
24-
*
25-
* @throws \Yajra\DataTables\Exceptions\Exception
23+
* @param Model|EloquentBuilder $model
2624
*/
27-
public function __construct($model)
25+
public function __construct(Model|EloquentBuilder $model)
2826
{
2927
$builder = match (true) {
3028
$model instanceof Model => $model->newQuery(),
3129
$model instanceof Relation => $model->getQuery(),
3230
$model instanceof EloquentBuilder => $model,
33-
default => throw new Exception('Invalid model type. Must be an instance of Eloquent Model, Eloquent Relation, or Eloquent Builder.'),
3431
};
3532

3633
parent::__construct($builder->getQuery());

0 commit comments

Comments
 (0)