7 проект, и у меня есть эта глобальная область действия для Voucher_detale
модель
<?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
class getVouchers implements Scope
{
public function apply(Builder $builder, Model $model)
{
$builder->where('vouchers_detale_state', '=', 1);
}
}
, и у меня есть Voucher
модель, и он имеет много внутри этого кода '
public function getDetales()
{
return $this->hasMany('App\Vouchers_detale','vouchers_detale_voucher_id','id')->withTrashed();
}
внутри лезвия у меня есть этот код
@foreach($voucher['getDetales'] as $v)
<tr class='table-warning'>
<td>
<a href='/{{$path}}/Vouchers_detales/{{$v["id"]}}'>{{$v['vouchers_detale_user_id']}}</a>
<div class='selected d-print-none'>
@foreach($v->getUpdate as $update)
<span style='color:black'>{{$update['update_history_old_amount']}}</span>
{{$update['created_at']}}
{{$update['getUserData']['user_name']}}
<hr />
@endforeach
</div>
</td>
<td>{{$v['getUserData']['user_name']}}</td>
@if($v['vouchers_detale_amount'] > 0)
<td>{{$v['vouchers_detale_amount']}}</td>
<td></td>
@php $total_debt += $v['vouchers_detale_amount'] @endphp
@else
<td></td>
<td>{{$v['vouchers_detale_amount'] * -1}}</td>
@php $total_credit += $v['vouchers_detale_amount'] * -1 @endphp
@endif
<td>{{$v['vouchers_detale_desc']}}</td>
</tr>
@endforeach
теперь, как я могу игнорировать глобальную область видимости в foreach, я попробовал это
@foreach($voucher['getDetales']->withoutGlobalScopes() as $v)
я получаю эту ошибку
Method Illuminate\Database\Eloquent\Collection::withoutGlobalScopes does not exist.
как я могу игнорировать глобальную область видимости из отношения в foreach, спасибо