Skip to content

Commit d54ecc9

Browse files
committed
add model
1 parent d342e28 commit d54ecc9

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Model.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,6 @@ public function __call($method, $parameters)
420420
}
421421

422422
public function boot($query){}
423+
424+
423425
}

src/Query.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ class Query
161161
*/
162162
public $model;
163163

164+
/**
165+
* Use model global scopes
166+
* @var bool
167+
*/
168+
public $useGlobalScopes = true;
169+
164170

165171
/**
166172
* Query constructor.
@@ -745,7 +751,7 @@ public function query()
745751
$query["type"] = $this->getType();
746752
}
747753

748-
if($this->model){
754+
if($this->model && $this->useGlobalScopes){
749755
$this->model->boot($this);
750756
}
751757

@@ -1383,4 +1389,14 @@ function __call($method, $parameters)
13831389
}
13841390

13851391
}
1392+
1393+
/**
1394+
* @return $this
1395+
*/
1396+
public function withoutGlobalScopes(){
1397+
1398+
$this->useGlobalScopes = false;
1399+
1400+
return $this;
1401+
}
13861402
}

0 commit comments

Comments
 (0)