<?php

namespace App\Policies;

use App\Admin;
use App\CategoryGroup;
use Illuminate\Auth\Access\HandlesAuthorization;

class CategoryGroupPolicy
{
    use HandlesAuthorization;


    public function before(Admin $admin)
    {
        //die('requested CategoryGroupPolicy');
        if ($admin->isSuperAdmin()) {
            return true;
        }
    }

    /**
     * Determine whether the user can view the categorygroup.
     *
     * @param  \App\User  $admin
     * @param  \App\Role  $role
     * @return mixed
     */
    public function view(Admin $admin, CategoryGroup $group)
    {
        //
        return $admin->hasPermission('categorygroup.view');
    }

    /**
     * Determine whether the user can create roles.
     *
     * @param  \App\User  $admin
     * @return mixed
     */
    public function create(Admin $admin)
    {
        //
        return $admin->hasPermission('categorygroup.create');
    }

    /**
     * Determine whether the user can update the categorygroup.
     *
     * @param  \App\User  $admin
     * @param  \App\Role  $role
     * @return mixed
     */
    public function update(Admin $admin, CategoryGroup $group)
    {
        //
        return $admin->hasPermission('categorygroup.update');
    }

    /**
     * Determine whether the user can delete the categorygroup.
     *
     * @param  \App\User  $admin
     * @param  \App\Role  $role
     * @return mixed
     */
    public function delete(Admin $admin, CategoryGroup $group)
    {
        //
        return $admin->hasPermission('categorygroup.delete');
    }
}
