2021-11-20 01:09:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Course\Requests;
|
|
|
|
|
|
|
|
use App\Course\Models\CourseMember;
|
|
|
|
use App\Member\Member;
|
2022-02-19 18:06:07 +01:00
|
|
|
use App\Setting\NamiSettings;
|
2021-11-20 01:09:28 +01:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class DestroyRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array<string, string>
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2022-02-19 18:06:07 +01:00
|
|
|
public function persist(Member $member, CourseMember $course, NamiSettings $settings): void
|
2021-11-20 01:09:28 +01:00
|
|
|
{
|
2022-02-19 18:06:07 +01:00
|
|
|
$settings->login()->deleteCourse($member->nami_id, $course->nami_id);
|
2021-11-20 01:09:28 +01:00
|
|
|
|
|
|
|
$course->delete();
|
|
|
|
}
|
|
|
|
}
|