Allowed memory size of 138412032 bytes exhausted (tried to allocate 20480 bytes)

Posted 2 months ago by yafeearun

i tried to update my role permissions and i have 73 permissions and i have used https://github.com/spatie/laravel-permission#extending for role and permission .

when i try to update a role with all permissions, got Allowed memory size of 138412032 bytes exhausted (tried to allocate 20480 bytes) most of the times and some times it works well.

public function update(Request $request, $id)
{
        $this->validate($request, [
                'name' => ['required', 'string', 'max:255'],
    ]);
        $role = Role::findOrFail($id);
        $role->update($request->except(['permissions']));
        $role->syncPermissions($request->permissions);
        //event(new RoleSaved($role));
        return response()->json($role, 200);
}

Please sign in or create an account to participate in this conversation.