main
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\DB\Te;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: AraNote
|
||||
* Date: 12/04/2018
|
||||
* Time: 10:34 PM
|
||||
*/
|
||||
class Scope
|
||||
{
|
||||
public $items, $query;
|
||||
|
||||
/**
|
||||
* Scope constructor.
|
||||
* @param $items
|
||||
*/
|
||||
public function __construct($query, $items)
|
||||
{
|
||||
$this->query = $query;
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
|
||||
public static function init($query, $items)
|
||||
{
|
||||
return new Scope($query, $items);
|
||||
}
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
foreach ($this->items as $index => $item) {
|
||||
Filter::init($this->query, $item, $index == 0)->run();
|
||||
}
|
||||
// dd($this->query->toSql());
|
||||
return $this->query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user