api code global jain
This commit is contained in:
58
app/Http/Requests/Api/Sangh/StoreSanghRequest.php
Normal file
58
app/Http/Requests/Api/Sangh/StoreSanghRequest.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user