<?php

namespace App\Policies;

use App\Admin;
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(Admin $admin)
    {
        if ($admin->isSuperAdmin()) {
            return true;
        }
    }


    public function view(Admin $admin, User $user)
    {
        //
        return $admin->hasPermission('user.view');
    }

    public function viewnew(Admin $admin, User $user)
    {
        //
        return $admin->hasPermission('user.viewnew');
    }


    public function create(Admin $admin, User $user)
    {
        //
        return $admin->hasPermission('user.create');
    }


    public function update(Admin $admin, User $user)
    {
        //
        return $admin->hasPermission('user.update');
    }


    public function delete(Admin $admin, User $user)
    {
        //
        return $admin->hasPermission('user.delete');
    }

}
