app/Policies/AlbumItemPolicy.php
/**
     * If user can set item as profile image
     *
     * @param User      $user
     * @param AlbumItem $albumItem
     * @return bool
     */
If user can set item as profile image
@param User      $user
@param AlbumItem $albumItem
@return bool
If user can set item as profile image @param User $user @param AlbumItem $albumItem @return bool
public function asProfile(User $user, AlbumItem $albumItem)
    {
        return $user->id === $albumItem->album->user_id 
               && $albumItem->album->type === 'profile' 
               && $albumItem->getFirstMedia()->id !== $user->picture_media_id; 
    }
public function asProfile ( User $ user , AlbumItem $ albumItem ) { return $ user -> id === $ albumItem -> album -> user_id && $ albumItem -> album -> type === 'profile' && $ albumItem -> getFirstMedia ( ) -> id !== $ user -> picture_media_id ; }
If user can set item as profile image
 @param User      $user
 @param AlbumItem $albumItem
 @return bool
If user can set item as profile image @param User $user @param AlbumItem $albumItem @return bool
// User is owner // Album type is profile // Is not set already