Update spatie/laravel permission tables from V1 to V2
source link: https://gist.github.com/fabricecw/58ee93dd4f99e78724d8acbb851658a4
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Update spatie/laravel permission tables from V1 to V2 · GitHub
Instantly share code, notes, and snippets.
Please add "permission_id" filed to select:
select(['user_id AS model_id', 'permission_id'])
From:$model_has_permissions = collect(DB::table('user_has_permissions')->select('user_id AS model_id')->get())->map(function($x) use ($userModelNamespace) { return (array) $x + ['model_type' => $userModelNamespace]; })->toArray();
To:$model_has_permissions = collect(DB::table('user_has_permissions')->select(['user_id AS model_id', 'permission_id'])->get())->map(function($x) use ($userModelNamespace) { return (array) $x + ['model_type' => $userModelNamespace]; })->toArray();
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK