mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Affiliate;
|
|
|
|
use App\Classes\Modules\Affiliate\ControllersLogic\CreateAffiliateLogic;
|
|
use App\Http\Requests\CreateAffiliateRequest;
|
|
use App\Models\Affiliate;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class CreateAffiliateController
|
|
{
|
|
/**
|
|
* @param CreateAffiliateRequest $request
|
|
* @param CreateAffiliateLogic $logic
|
|
* @return JsonResponse
|
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
|
*/
|
|
public function create(CreateAffiliateRequest $request, CreateAffiliateLogic $logic): JsonResponse {
|
|
$this->authorize('create', Affiliate::class);
|
|
return $logic->execute($request);
|
|
}
|
|
|
|
/**
|
|
* Authorize a given action for the current user.
|
|
*
|
|
* @param mixed $ability
|
|
* @param mixed|array $arguments
|
|
* @return \Illuminate\Auth\Access\Response
|
|
*
|
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
|
*/
|
|
public function authorize($ability, $arguments = [])
|
|
{
|
|
return app(\Illuminate\Contracts\Auth\Access\Gate::class)->authorize($ability, $arguments);
|
|
}
|
|
}
|
|
|