<?php

namespace App\Policies;

use App\Facade\UserConfig;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class UserPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    public function before($user, $ability)
    {
        if (!UserConfig::get('social_user_profiles'))
        {
            // Social profiles not enabled
            return false;
        }
    }

    public function view(User $user, User $userBeingAccessed)
    {
        return $userBeingAccessed->enable_profile_page;
    }
}