Skip to content

Commit 0eed6e8

Browse files
Merge pull request #36 from TheDragonCode/3.x
Added `query` method for Laravel helper
2 parents ba18e1c + d562d82 commit 0eed6e8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Support/ModelHelper.php

+15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace DragonCode\LaravelSupport\Support;
44

55
use DragonCode\LaravelSupport\Exceptions\IncorrectModelException;
6+
use Illuminate\Database\Eloquent\Builder;
67
use Illuminate\Database\Eloquent\Model;
78

89
class ModelHelper
@@ -82,6 +83,20 @@ public function primaryKeyType($model): string
8283
->getKeyType();
8384
}
8485

86+
/**
87+
* @param \Illuminate\Database\Eloquent\Model|string $model
88+
*
89+
* @throws \DragonCode\LaravelSupport\Exceptions\IncorrectModelException
90+
*
91+
* @return \Illuminate\Database\Eloquent\Builder
92+
*/
93+
public function query($model): Builder
94+
{
95+
return $this
96+
->model($model)
97+
->newQuery();
98+
}
99+
85100
/**
86101
* @param \Illuminate\Database\Eloquent\Model|string $model
87102
*

0 commit comments

Comments
 (0)