Files
InvoiceShelf/app/Policies/CompanyPolicy.php
Darko Gjorgjijoski 6b80b5f48d Change namespace
2024-01-27 23:53:20 +01:00

40 lines
711 B
PHP

<?php
namespace InvoiceShelf\Policies;
use InvoiceShelf\Models\Company;
use InvoiceShelf\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class CompanyPolicy
{
use HandlesAuthorization;
public function create(User $user)
{
if ($user->isOwner()) {
return true;
}
return false;
}
public function delete(User $user, Company $company)
{
if ($user->id == $company->owner_id) {
return true;
}
return false;
}
public function transferOwnership(User $user, Company $company)
{
if ($user->id == $company->owner_id) {
return true;
}
return false;
}
}