PHP code example of med-ezzairi / account-module
1. Go to this page and download the library: Download med-ezzairi/account-module library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
med-ezzairi / account-module example snippets
bash
php artisan module:migrate account
namespace App\Permissions\Shop;
use Modules\Account\Permissions\ResourcePermission;
use App\Models\Shop\Order;
use App\User;
class OrderResourcePermission extends ResourcePermission {
/**
* Check the user permission on the resource
*
* @param User $user
* @param Order $resource
* @return boolean
*/
protected function delete( User $user, Order $resource )
{
$role_id = $user->getRole();
return $user->id == $resource->id || $role_id == 'admin';
}
}