59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Api\Sangh;
|
||
|
|
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class StoreSanghRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return bool
|
||
|
|
*/
|
||
|
|
public function authorize()
|
||
|
|
{
|
||
|
|
return Constant::STATUS_TRUE;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
$request = [
|
||
|
|
'sangh_type' => 'required',
|
||
|
|
'name' => 'required',
|
||
|
|
'state' => 'required',
|
||
|
|
'city' => 'required',
|
||
|
|
'address' => 'required',
|
||
|
|
'email' => 'email',
|
||
|
|
'mobile_number' => 'required',
|
||
|
|
'number_of_members' => 'required',
|
||
|
|
'bank_account_number' => 'integer',
|
||
|
|
'avatar' => 'required'
|
||
|
|
];
|
||
|
|
|
||
|
|
if($this->library_status === Constant::STATUS_ONE){
|
||
|
|
$request['library_name'] = 'required';
|
||
|
|
$request['librarian_name'] = 'required';
|
||
|
|
$request['librarian_mobile_number'] = 'required';
|
||
|
|
$request['number_of_books'] = 'required';
|
||
|
|
}
|
||
|
|
if ($this->sangh_type === Constant::STATUS_TWO) {
|
||
|
|
$request['mulnayak_bhagwan_name'] = 'required';
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($this->bank_account_number != '') {
|
||
|
|
$request['bank_ifsc'] = 'required';
|
||
|
|
$request['bank_branch'] = 'required';
|
||
|
|
}
|
||
|
|
|
||
|
|
return $request;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|