<?php

namespace App\Policies;

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

class InvoicePolicy
{
    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, Invoice $invoice)
    {
        //
        return $admin->hasPermission('invoice.view');
    }


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


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


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