You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The form model is not maintaining global scope methods in the quick update, i have called global scope disable method like $form->model()->withoutGlobalScope('status') but when i try to quick update status field from grid the code is throwing error No query results for model [App\Models\User] 16
Steps To Reproduce:
Add global scope in model
disable global scope in form model
Add quick edit boolean switch in grid and enable / disable switch
The text was updated successfully, but these errors were encountered:
This looks like not an issue to me, but rather expected behavior as you can't change query for Form's Model.
In Grid you can do it (as you probably did), but for the Form it takes Model and does findOrFail with all booted scopes etc, so you not only can't edit values within the Grid, but open Edit form / page for the Instance that is not-active (in your example) / not-found.
The only OK solution for this I can suggest is to use not the original Model class, but extended and modified AdminModel class, that doesn't have said global scopes registered. For example:
<?phpnamespaceApp\Admin\Models;
useApp\Models\UserasModel;
classUserextendsModel
{
protectedstaticfunctionbooted()
{
// NOTE: empty for the override
}
}
And in your App\Admin\Controllers\UserController use App\Admin\Models\User instead of App\Models\User.
And in your App\Admin\Controllers\UserController use App\Admin\Models\User instead of App\Models\User.
thanks for your suggestion, this can work, but I am planning to use global scope in 4-5 models which will be extended only for admin task.
i was expecting when it's working in grid and view model then it should also work as same in form model.
Description:
The form model is not maintaining global scope methods in the quick update, i have called global scope disable method like
$form->model()->withoutGlobalScope('status')
but when i try to quick update status field from grid the code is throwing errorNo query results for model [App\Models\User] 16
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: