Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = $this->model->customerWithCentralBillingChildren($customer);
- dd($query);
- public function scopeCustomerWithCentralBillingChildren($query, Customer $customer)
- {
- $accdes = [CUT] // doesn't matter
- return $query->whereIn('accde', $accdes);
- }
- class SyncActive implements Scope
- {
- /**
- * Apply the scope to a given Eloquent query builder.
- *
- * @param IlluminateDatabaseEloquentBuilder $builder
- * @param IlluminateDatabaseEloquentModel $model
- * @return void
- */
- public function apply(Builder $builder, Model $model)
- {
- $builder->where('sync_active', '=', true);
- }
- }
- Builder {#858 ▼
- #query: Builder {#859 ▶}
- #model: Transaction {#676 ▶}
- #eagerLoad: []
- #localMacros: []
- #onDelete: null
- #passthru: array:13 [▶]
- #scopes: array:1 [▼
- "AppScopesSyncActive" => SyncActive {#677} <---- global scope OK
- ]
- #removedScopes: []
- }
- dd($query->toSql());
- "select * from `sync_transactions` where `accde` in (?, ?, ?, ?, ?, ?) and `sync_active` = ?"
- where `accde` in (?, ?, ?, ?, ?, ?)
- `sync_active` = ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement