first commit
This commit is contained in:
54
app/Http/Requests/Admission/AdmissionRequest.php
Normal file
54
app/Http/Requests/Admission/AdmissionRequest.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admission;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AdmissionRequest 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()
|
||||
{
|
||||
$rules = [
|
||||
'student_id'=>'required',
|
||||
'country_id' => 'required|',
|
||||
'state_id' => 'required|',
|
||||
'college_id' => 'required|',
|
||||
'fees' => 'required|',
|
||||
'intake_year' => 'required|',
|
||||
'intake_month' => 'required|',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function data()
|
||||
{
|
||||
$data = [
|
||||
'student_id' => $this->get('student_id'),
|
||||
'college_id' => $this->get('college_id'),
|
||||
'fees' => $this->get('fees'),
|
||||
'country_id' => $this->get('country_id'),
|
||||
'state_id' => $this->get('state_id'),
|
||||
'intake_year' => $this->get('intake_year'),
|
||||
'intake_month' => $this->get('intake_month'),
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
42
app/Http/Requests/Agent/AgentRequest.php
Normal file
42
app/Http/Requests/Agent/AgentRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Agent;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AgentRequest 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',
|
||||
];
|
||||
}
|
||||
|
||||
public function data()
|
||||
{
|
||||
$data = [
|
||||
'name' => $this->get('name'),
|
||||
'email' => $this->get('email'),
|
||||
'phone' => $this->get('phone'),
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Auth\Events\Lockout;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class LoginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email'],
|
||||
'password' => ['required', 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to authenticate the request's credentials.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function authenticate(): void
|
||||
{
|
||||
$this->ensureIsNotRateLimited();
|
||||
|
||||
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||
RateLimiter::hit($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => trans('auth.failed'),
|
||||
]);
|
||||
}
|
||||
|
||||
RateLimiter::clear($this->throttleKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the login request is not rate limited.
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function ensureIsNotRateLimited(): void
|
||||
{
|
||||
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event(new Lockout($this));
|
||||
|
||||
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => trans('auth.throttle', [
|
||||
'seconds' => $seconds,
|
||||
'minutes' => ceil($seconds / 60),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rate limiting throttle key for the request.
|
||||
*/
|
||||
public function throttleKey(): string
|
||||
{
|
||||
return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip());
|
||||
}
|
||||
}
|
75
app/Http/Requests/Campaign/CampaignRequest.php
Normal file
75
app/Http/Requests/Campaign/CampaignRequest.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Campaign;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CampaignRequest 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()
|
||||
{
|
||||
$rules = [
|
||||
'name'=>'required'
|
||||
];
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function data(){
|
||||
|
||||
$inputs=[
|
||||
'name' => $this->get('name'),
|
||||
'alias' => $this->get('alias'),
|
||||
'details' => $this->get('details'),
|
||||
'starts' => $this->get('starts'),
|
||||
'ends' => $this->get('ends'),
|
||||
'success_message' => $this->get('success_message'),
|
||||
'email_success' => $this->get('email_success'),
|
||||
'sms_message' => $this->get('sms_message'),
|
||||
'coupon_codes' => $this->get('coupon_codes'),
|
||||
'url' => $this->get('url'),
|
||||
'keywords' => $this->get('keywords'),
|
||||
'ogtags' => $this->get('ogtags'),
|
||||
'headers' => $this->get('headers'),
|
||||
'description' => $this->get('description'),
|
||||
'status' => ($this->get('status') ? $this->get('status') : '') == 'on' ? 'active' : 'in_active',
|
||||
'created_by' => Auth()->user()->id,
|
||||
];
|
||||
|
||||
if($this->get('offered_course')) {
|
||||
$offered_course = collect($this->get('offered_course'));
|
||||
}
|
||||
|
||||
if(isset($offered_course)) {
|
||||
$inputs['offered_course'] = $offered_course->implode(',');
|
||||
}
|
||||
|
||||
if($this->get('keywords')) {
|
||||
$keywords = collect($this->get('keywords'));
|
||||
}
|
||||
|
||||
if(isset($keywords)) {
|
||||
$inputs['keywords'] = $keywords->implode(',');
|
||||
}
|
||||
|
||||
if ($this->has('status')) {
|
||||
$inputs['status'] = "active";
|
||||
}
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\DocumentCheckList;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DocumentCheckListRequest 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 [
|
||||
'applicant' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/Permission/PermissionRequest.php
Normal file
32
app/Http/Requests/Permission/PermissionRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Permission;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PermissionRequest 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()
|
||||
{
|
||||
$rules = [
|
||||
'name'=>'required'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
23
app/Http/Requests/ProfileUpdateRequest.php
Normal file
23
app/Http/Requests/ProfileUpdateRequest.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ProfileUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => ['string', 'max:255'],
|
||||
'email' => ['email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/Role/RoleRequest.php
Normal file
32
app/Http/Requests/Role/RoleRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Role;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RoleRequest 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()
|
||||
{
|
||||
$rules = [
|
||||
'name'=>'required'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
45
app/Http/Requests/Student/StudentRequest.php
Normal file
45
app/Http/Requests/Student/StudentRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Student;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StudentRequest 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 [
|
||||
'applicant' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function data()
|
||||
{
|
||||
$data = [
|
||||
'applicant' => $this->get('applicant'),
|
||||
'email' => $this->get('email'),
|
||||
'phone' => $this->get('phone'),
|
||||
'program' => $this->get('program'),
|
||||
'intake_year' => $this->get('intake_year'),
|
||||
'intake_month' => $this->get('intake_month'),
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
34
app/Http/Requests/User/UserRequest.php
Normal file
34
app/Http/Requests/User/UserRequest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\User;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserRequest 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()
|
||||
{
|
||||
$rules = [
|
||||
'name'=>'required',
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'password' => 'required|',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user