api code global jain

This commit is contained in:
Abhishek Mali
2025-11-05 10:37:10 +05:30
commit 52fe7e2bec
2834 changed files with 1784903 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Api\Chaturmas;
use Illuminate\Foundation\Http\FormRequest;
class GetChaturmasRequest 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
*/
public function rules()
{
return [
'page' => 'integer',
'limit' => 'integer',
'sant_id' => 'required|exists:sants,id',
];
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\Api\Chaturmas;
use Illuminate\Foundation\Http\FormRequest;
class StoreChaturmasRequest 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
*/
public function rules()
{
return [
'sant_id' => 'exists:sants,id',
'sagh_id' => 'exists:sanghs,id',
'place' => 'nullable',
'year' => 'required|exists:chaturmas_dates,id|date_format:Y',
];
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function message()
{
return [
'year.exists' => 'Chaturmas already exist for selected year.',
];
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\Api\Chaturmas;
use Illuminate\Foundation\Http\FormRequest;
class UpdateChaturmasRequest 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
*/
public function rules()
{
return [
'sant_id' => 'exists:sants,id',
'sagh_id' => 'exists:sanghs,id',
'place' => 'nullable',
'year' => 'required|exists:chaturmas_dates,id|date_format:Y',
];
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function message()
{
return [
'year.exists' => 'Chaturmas already exist for selected year.',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Api\ChaturmasReview;
use Illuminate\Foundation\Http\FormRequest;
class StoreChaturmasReviewRequest 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
*/
public function rules()
{
return [
'sant_id' => 'required|exists:sants,id',
'comment' => 'required',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\ChaturmasReview;
use Illuminate\Foundation\Http\FormRequest;
class UpdateChaturmasReviewRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Api\FriendRequest;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class StoreFriendRequest 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()
{
return [
'receiver_id' => 'required',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Api\FriendRequest;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class UpdateFriendRequest 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()
{
return [
'receiver_id' => 'required',
'status' => 'required'
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\Api\Insurance;
use Illuminate\Foundation\Http\FormRequest;
class StoreInsuranceRequest 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
*/
public function rules()
{
return [
'hospital_id' => 'required',
'full_name' => 'required',
'address' => 'required',
'email' => 'required|email',
'medical_problem' => 'required',
'aadhar_card_number' => 'required|max:12|min:12',
'aadhar_card_front_photo' => 'required|image|mimes:jpeg,png,jpg,webp|max:2048',
'aadhar_card_back_photo' => 'required|image|mimes:jpeg,png,jpg,webp|max:2048',
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Http\Requests\Api\PassiveUser;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class StorePassiveUserRequest 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()
{
return [
'name' => 'required',
'relationship' => 'required',
'birth_date' => 'required|date_format:Y-m-d|lessThan:14',
'avatar' => 'mimes:jpeg,png,jpg',
// 'school_name' => 'required',
// 'about' => 'required',
];
}
/**
* Get the validation messages that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'birth_date.less_than' => "Age must me less than 14 years",
];
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Http\Requests\Api\PassiveUser;
use Illuminate\Foundation\Http\FormRequest;
use App\Constant\Constant;
class UpdatePassiveUserRequest 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()
{
return [
'name' => 'required',
'relationship' => 'required',
'birth_date' => 'required|date_format:Y-m-d|lessThan:14',
'avatar' => 'mimes:jpeg,png,jpg',
// 'school_name' => 'required',
// 'about' => 'required'
];
}
/**
* Get the validation messages that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'birth_date.less_than' => "Age must me less than 14 years",
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class GetSantPostRequest 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
*/
public function rules()
{
$array = [
'sant_id' => 'nullable|exists:sants,id',
];
return $array;
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class PostAddCommentRequest 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
*/
public function rules()
{
return [
'post_id' => 'required|exists:posts,id',
'reply_id' => 'nullable|exists:post_comments,id',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class PostLikeRequest 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
*/
public function rules()
{
return [
'post_id' => 'required|exists:posts,id',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class PostRemoveCommentRequest 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
*/
public function rules()
{
return [
'comment_id' => 'required|exists:post_comments,id',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class PostUpdateCommentRequest 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
*/
public function rules()
{
return [
'post_id' => 'required|exists:posts,id',
];
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Http\Requests\Api\Post;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Route;
use Illuminate\Http\Request;
class StorePostRequest 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
*/
public function rules(Request $request)
{
$data = $request->all();
$array = [
'privacy' => 'required',
'images' => 'array|required_without:description',
'images.*' => 'image|mimes:jpeg,png,jpg,gif|max:15360',
'description' => 'required_without:images',
'category_id' => 'required|exists:categories,id',
'type' => 'nullable|in:1,2,3',
'type_id' => 'nullable|exists:users,id',
];
$name = Route::currentRouteName();
if ($name == 'api.post.sant.store') {
$array['type_id'] = 'required|exists:sants,id';
$array['type'] = 'required|in:2';
}
if ($data['type'] == Constant::POST_TYPE_SANT) {
$array['type_id'] = 'required|exists:sants,id';
$array['type'] = 'required|in:2';
}
if ($data['type'] == Constant::POST_TYPE_SANGH) {
$array['type_id'] = 'required|exists:sanghs,id';
$array['type'] = 'required|in:3';
}
return $array;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests\Api\Post;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePostRequest 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
*/
public function rules()
{
$array = [
'privacy' => 'required',
'images' => 'array|required_without:description',
'images.*' => 'image|mimes:jpeg,png,jpg|max:15360',
'description' => 'required_without:images',
'category_id' => 'required|exists:categories,id',
'removed_image_id' => 'array'
];
if ($this->post->postImages()->exists()) {
$array['description'] = 'nullable';
$array['images'] = 'array';
}
return $array;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\Sangh;
use Illuminate\Foundation\Http\FormRequest;
class SanghFollowRequest 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
*/
public function rules()
{
return [
'sangh_id' => 'required|exists:sanghs,id',
];
}
}

View 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;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests\Api\Sangh;
use Illuminate\Foundation\Http\FormRequest;
use App\Constant\Constant;
class UpdateSanghRequest 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()
{
return [
// 'name' => 'required',
// 'father_name' => 'required',
// 'mother_name' => 'required',
// 'gender' => 'required',
// 'avatar' => 'mimes:jpeg,png,jpg',
// 'honor' => 'required',
// 'dharma_id' => 'required',
// 'sampraday_id' => 'required',
// 'birth_date' => 'required',
// 'diksha_date' => 'required',
// 'diksha_place' => 'required',
// 'about' => 'required'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Api\Sant;
use Illuminate\Foundation\Http\FormRequest;
class SantFollowRequest 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
*/
public function rules()
{
return [
'sant_id' => 'required|exists:sants,id',
];
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\Api\Sant;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class StoreSantRequest 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()
{
return [
'name' => 'required',
// 'father_name' => 'required',
// 'mother_name' => 'required',
'gender' => 'required',
'avatar' => ['nullable','mimes:jpeg,png,jpg'],
// 'honor' => 'required',
'dharma_id' => 'required',
'sampraday_id' => 'required',
// 'birth_date' => 'required',
// 'diksha_date' => 'required',
// 'diksha_place' => 'required',
'about' => 'nullable'
];
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests\Api\Sant;
use Illuminate\Foundation\Http\FormRequest;
use App\Constant\Constant;
class UpdateSantRequest 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()
{
return [
'name' => 'required',
// 'father_name' => 'required',
// 'mother_name' => 'required',
'gender' => 'required',
'avatar' => ['nullable','mimes:jpeg,png,jpg'],
// 'honor' => 'required',
'dharma_id' => 'required',
'sampraday_id' => 'required',
// 'birth_date' => 'required',
// 'diksha_date' => 'required',
// 'diksha_place' => 'required',
'about' => 'nullable'
];
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Http\Requests\Api\Thana;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
class StoreThanaRequest 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
*/
public function rules()
{
return [
'sant_id' => 'required|exists:sants,id'
];
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Http\Requests\Api\Thana;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Log;
class UpdateThanaRequest 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
*/
public function rules()
{
return [
'sant_id' => 'required|exists:sants,id'
];
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Http\Requests\Api\Vihar;
use App\Rules\DeleteVihar;
use Carbon\Carbon;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
class DeleteViharRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function getValidatorInstance()
{
$this->request->set('delete', 1);
return parent::getValidatorInstance();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$array = [
'delete' => 'sometimes',
];
$startDate = Carbon::createFromFormat('Y-m-d H:i:s', $this->vihar->start_date .' '. '00:00:00');
$todayDate = Carbon::createFromFormat('Y-m-d H:i:s', Carbon::now()->format('Y-m-d') .' '. '00:00:00');
$result = $todayDate->eq($startDate);
if ($result) {
$array['delete'] = [new DeleteVihar($this->vihar)];
}
return $array;
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'start_time.after' => 'Please enter a time after the current time.',
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Api\Vihar;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
class GetViharRequest 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
*/
public function rules()
{
return [
'page' => 'integer',
'limit' => 'integer',
'sant_id' => 'required|exists:sants,id',
];
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace App\Http\Requests\Api\Vihar;
use App\Rules\ViharCanNotAfterTwoHours;
use Carbon\Carbon;
use App\Rules\ViharDoesNotStoreForSameDateTime;
use App\Rules\ViharStorePerDay;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Log;
class StoreViharRequest extends FormRequest
{
/**
* Indicates if the validator should stop on the first rule failure.
*
* @var bool
*/
protected $stopOnFirstFailure = true;
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function getValidatorInstance()
{
$this->request->set('per_day', 2);
$this->request->set('date_time', 1);
$this->request->set('next_vihar', 1);
return parent::getValidatorInstance();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(Request $request)
{
$array = [
'sant_id' => 'exists:sants,id',
'from' => 'required',
'to' => 'required',
'start_date' => 'required|date_format:Y-m-d',
'start_time' => 'date_format:H:i',
// 'end_date' => 'required|date_format:Y-m-d|after_or_equal:start_date',
'per_day' => [new ViharStorePerDay($request->all())],
'date_time' => [new ViharDoesNotStoreForSameDateTime($request->all())],
'next_vihar' => [new ViharCanNotAfterTwoHours($request->all())],
];
$startDate = Carbon::createFromFormat('Y-m-d H:i:s', $request->start_date .' '. '00:00:00');
$todayDate = Carbon::createFromFormat('Y-m-d H:i:s', Carbon::now()->format('Y-m-d') .' '. '00:00:00');
$result = $todayDate->eq($startDate);
if ($result) {
$array['start_time'] = 'date_format:H:i|after:'.Carbon::now()->format('H:i');
}
return $array;
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'start_time.after' => 'Please enter a time after the current time.',
];
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace App\Http\Requests\Api\Vihar;
use App\Rules\ViharCanNotAfterTwoHours;
use Carbon\Carbon;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use App\Rules\ViharDoesNotStoreForSameDateTime;
use App\Rules\ViharStorePerDay;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Support\Facades\Log;
class UpdateViharRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function getValidatorInstance()
{
$this->request->set('per_day', 2);
$this->request->set('date_time', 1);
$this->request->set('next_vihar', 1);
return parent::getValidatorInstance();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(Request $request)
{
$array = [
'sant_id' => 'exists:sants,id',
'from' => 'required',
'to' => 'required',
'start_date' => 'required|date_format:Y-m-d',
'start_time' => 'required|date_format:H:i',
// 'end_date' => 'required|date_format:Y-m-d|after_or_equal:start_date',
// 'end_time' => 'date_format:H:i|after:start_time',
// 'end_date' => 'required|date_format:Y-m-d|after_or_equal:start_date',
'date_time' => [new ViharDoesNotStoreForSameDateTime($request->all(), $this->vihar->id)],
'per_day' => [new ViharStorePerDay($request->all(), $this->vihar->id)],
'next_vihar' => [new ViharCanNotAfterTwoHours($request->all(), $this->vihar->id)],
];
$startDate = Carbon::createFromFormat('Y-m-d H:i:s', $request->start_date .' '. '00:00:00');
$todayDate = Carbon::createFromFormat('Y-m-d H:i:s', Carbon::now()->format('Y-m-d') .' '. '00:00:00');
$result = $todayDate->eq($startDate);
if ($result) {
$array['start_time'] = 'date_format:H:i|after:'.Carbon::now()->format('H:i');
}
return $array;
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function messages()
{
return [
'start_time.after' => 'Please enter a time after the current time.',
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Http\Requests\ChangePassword;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class ChangePasswordRequest
* @package App\Modules\Frontend\Auth\Http\Requests\ChangePassword
*/
class ChangePasswordRequest extends FormRequest
{
/**
* Indicates if the validator should stop on the first rule failure.
*
* @var bool
*/
protected $stopOnFirstFailure = true;
/**
* 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
*/
public function rules()
{
return [
'current_password' => 'required',
'new_password' => 'required|min:8|same:confirm_password',
'confirm_password' => 'required',
];
}
/**
* Get the validation massages that apply to the rules.
*
* @return array
*/
public function messages()
{
return [
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Http\Requests\ChangePassword;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Http\Request;
/**
* Class SetPasswordRequest
* @package App\Modules\Frontend\Auth\Http\Requests\ChangePassword
*/
class SetPasswordRequest extends FormRequest
{
/**
* Indicates if the validator should stop on the first rule failure.
*
* @var bool
*/
protected $stopOnFirstFailure = true;
/**
* 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
*/
public function rules()
{
return [
'country_code' => 'required',
'mobile' => 'required',
'new_password' => 'required|min:8|same:confirm_password',
'confirm_password' => 'required',
];
}
/**
* Get the validation massages that apply to the rules.
*
* @return array
*/
public function messages()
{
return [
];
}
protected function failedValidation(Validator $validator)
{
if (Request::wantsJson()) {
throw new HttpResponseException(response()->json(['message' => $validator->errors()->first(), 'error' => true, 'status' => 422], 422));
} else {
throw new ValidationException($validator);
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\Chaturmas;
use App\Models\Sant;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
class StoreChaturmasRequest 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
*/
public function rules(Request $request)
{
return [
'place' => 'required',
'chaturmas_date_id' => [
'required' , 'exists:chaturmas_dates,id',
'date_format:Y',
Rule::unique('chaturmas', 'chaturmas_date_id')
->where('sant_id', $request->route('sant')->id),
]
];
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests\Chaturmas;
use Illuminate\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
class UpdateChaturmasRequest 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
*/
public function rules(Request $request)
{
return [
'place' => 'required',
'chaturmas_date_id' => [
'required',
'exists:chaturmas_dates,id',
'date_format:Y',
Rule::unique('chaturmas', 'chaturmas_date_id')
->where('sant_id', $this->chaturma->sant_id)
->ignore($this->chaturma->id),
]
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\ChaturmasDate;
use Illuminate\Foundation\Http\FormRequest;
class StoreChaturmasDateRequest 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
*/
public function rules()
{
return [
'year' => 'required|date_format:Y|unique:chaturmas_dates,year',
'from' => 'required|date_format:Y-m-d',
'to' => 'required|date_format:Y-m-d|after_or_equal:from',
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\ChaturmasDate;
use Illuminate\Foundation\Http\FormRequest;
class UpdateChaturmasDateRequest 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
*/
public function rules()
{
return [
'year' => 'required|date_format:Y|unique:chaturmas_dates,year,'.$this->chaturmas_date->id,
'from' => 'required|date_format:Y-m-d',
'to' => 'required|date_format:Y-m-d|after_or_equal:from',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Dharma;
use Illuminate\Foundation\Http\FormRequest;
class StoreDharmaRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:dharma,name',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Dharma;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDharmaRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:dharma,name,'.$this->dharma->id,
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\Hospital;
use Illuminate\Foundation\Http\FormRequest;
class HospitalStoreRequest 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
*/
public function rules()
{
return [
'name' => 'required',
'contact_name' => 'required',
'email' => 'required',
'number' => 'required',
'photo' => 'required',
'city' => 'required',
'state' => 'required',
'address' => 'required',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Jati;
use Illuminate\Foundation\Http\FormRequest;
class StoreJatiRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:jatis,name',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Jati;
use Illuminate\Foundation\Http\FormRequest;
class UpdateJatiRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:jatis,name,'.$this->jati->id,
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class StoreRoleRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:roles,name',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Role;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRoleRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:roles,name,'.$this->role->id,
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Sampraday;
use Illuminate\Foundation\Http\FormRequest;
class StoreSampradayRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:sampradays,name',
'dharma_id' => 'required',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Sampraday;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSampradayRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:sampradays,name,'.$this->sampraday->id,
'dharma_id' => 'required',
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests\Sangh;
use Illuminate\Foundation\Http\FormRequest;
class CreateSanghMemberCard 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
*/
public function rules()
{
return [
'profile_image' => 'max:2048'
];
}
public function messages()
{
return [
'profile_image.max' => 'The profile image must not exceed 2 MB.'
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Sangh;
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 false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Requests\Sangh;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSanghRequest 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
*/
public function rules()
{
return [
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Sant;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class StoreSantRequest 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()
{
return [
'name' => 'required',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Sant;
use App\Constant\Constant;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSantRequest 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()
{
return [
'name' => 'required',
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreDesignationRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePostImageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreThanaMemberRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreThanaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDesignationRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePostImageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateThanaMemberRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateThanaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Http\Requests\User;
use App\Rules\CheckUniqueEmailHashValue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
class AdminStoreRequest 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
*/
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email|unique:users,email',
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', new CheckUniqueEmailHashValue],
];
}
/**
* @return array
*/
public function messages()
{
return [
'name.required' => __('validation.required'),
'email.required' => __('validation.required'),
'email.unique' => __('validation.unique'),
];
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\User;
use App\Rules\CheckUniqueEmailHashValue;
use Illuminate\Foundation\Http\FormRequest;
class AdminUpdateRequest 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
*/
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.$this->user->id,
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', new CheckUniqueEmailHashValue($this->user->id)],
];
}
/**
* @return array
*/
public function messages()
{
return [
'name.required' => __('validation.required'),
'email.required' => __('validation.required'),
'email.unique' => __('validation.unique'),
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class StoreUserRequest 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
*/
public function rules()
{
return [
'name' => 'required|unique:users,name',
'email' => 'required|email|unique:users,email',
'mobile' => 'required|unique:users,mobile',
'avatar' => 'required|mimes:jpeg,png,jpg',
'gender' => 'required',
'dharma_id' => 'required',
'jati_id' => 'required',
'profession' => 'required',
// 'speciality_of_profession' => 'required',
/*'native_place' => 'required',
'current_location' => 'required',
'status' => 'required'*/
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class UpdateUserRequest 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
*/
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email|unique:users,email,'.$this->user->id,
'mobile' => 'required|unique:users,mobile,'.$this->user->id,
'avatar' => 'required||mimes:jpeg,png,jpg',
'gender' => 'required',
'dharma_id' => 'required',
'jati_id' => 'required',
'profession' => 'required',
// 'speciality_of_profession' => 'required',
/*'native_place' => 'required',
'current_location' => 'required',
'status' => 'required'*/
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Vihar;
use Illuminate\Foundation\Http\FormRequest;
class StoreViharRequest 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
*/
public function rules()
{
return [
'sant_id' => 'exists:sants,id',
'from' => 'required',
'to' => 'required',
'start_date' => 'required|date_format:Y-m-d',
'start_time' => 'required|date_format:H:i'
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests\Vihar;
use Illuminate\Foundation\Http\FormRequest;
class UpdateViharRequest 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
*/
public function rules()
{
return [
'sant_id' => 'exists:sants,id',
'start_date' => 'required|date_format:Y-m-d',
'start_time' => 'required|date_format:H:i',
];
}
}