You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
656 B
31 lines
656 B
<?php
|
|
|
|
namespace App\Http\Forms\SchoolForms;
|
|
|
|
use App\StudentParent;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ManipulateParentForm extends FormRequest
|
|
{
|
|
public function rules()
|
|
{
|
|
return [
|
|
'mobile' => 'required|exsits:student_parents',
|
|
];
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$parent = StudentParent::where('mobile', $this->mobile)->first();
|
|
$parent->mobile = $this->mobile;
|
|
$parent->save();
|
|
return $parent;
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
$parent = StudentParent::where('mobile', $this->mobile)->first();
|
|
$parent->delete();
|
|
return [];
|
|
}
|
|
}
|
|
|