mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
30ed77f304
# Conflicts: # resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue # routes/api.php
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Affiliate;
|
|
|
|
use App\Classes\Modules\Affiliate\ControllersLogic\UpdateAffiliateLogic;
|
|
use App\Http\Requests\UpdateAffiliateRequest;
|
|
use App\Models\Affiliate;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class UpdateAffiliateController
|
|
{
|
|
/**
|
|
* @param UpdateAffiliateRequest $request
|
|
* @param int $id
|
|
* @param UpdateAffiliateLogic $logic
|
|
* @return JsonResponse
|
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
|
*/
|
|
public function update(UpdateAffiliateRequest $request, int $id, UpdateAffiliateLogic $logic): JsonResponse {
|
|
$affiliate = Affiliate::findOrFail($id);
|
|
$this->authorize('update', $affiliate);
|
|
return $logic->execute($request, $id);
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
}
|
|
|