policies['listMedia'])) { return $user->policies['listMedia'] === true; } return data_get($user->policies, 'listMedia.id') === $model->id && data_get($user->policies, 'listMedia.collection') === $collection; } public function storeMedia(User $user, HasMedia $model, string $collection): bool { if (is_bool($user->policies['storeMedia'])) { return $user->policies['storeMedia'] === true; } return data_get($user->policies, 'storeMedia.id') === $model->id && data_get($user->policies, 'storeMedia.collection') === $collection; } public function updateMedia(User $user, HasMedia $model, string $collection): bool { if (is_bool($user->policies['updateMedia'])) { return $user->policies['updateMedia'] === true; } return data_get($user->policies, 'updateMedia.id') === $model->id && data_get($user->policies, 'updateMedia.collection') === $collection; } public function destroyMedia(User $user, HasMedia $model, string $collection): bool { if (is_bool($user->policies['destroyMedia'])) { return $user->policies['destroyMedia'] === true; } return data_get($user->policies, 'destroyMedia.id') === $model->id && data_get($user->policies, 'destroyMedia.collection') === $collection; } }