Updates
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
/**
|
||||
* AgentRequest.
|
||||
@@ -29,11 +29,10 @@ class AgentRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$check = $this->check(new CommonSettings());
|
||||
$check = $this->check(new CommonSettings);
|
||||
if ($check != 0) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
return [
|
||||
'user_name' => 'required|unique:users|max:30',
|
||||
'first_name' => 'required|max:30',
|
||||
@@ -46,18 +45,15 @@ class AgentRequest extends Request
|
||||
'agent_time_zone' => 'required',
|
||||
// 'phone_number' => 'phone:IN',
|
||||
'mobile' => 'unique:users',
|
||||
'team' => 'required',
|
||||
'team' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*@category Funcion to set rule if send opt is enabled
|
||||
*
|
||||
*@param object $settings (instance of Model common settings)
|
||||
*
|
||||
*@param Object $settings (instance of Model common settings)
|
||||
*@author manish.verma@ladybirdweb.com
|
||||
*
|
||||
*@return array|int
|
||||
*@return array|int
|
||||
*/
|
||||
public function check($settings)
|
||||
{
|
||||
@@ -76,8 +72,8 @@ class AgentRequest extends Request
|
||||
// 'phone_number' => 'phone:IN',
|
||||
// 'mobile' => 'phone:IN',
|
||||
'team' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
'country_code' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
'country_code' => 'required',
|
||||
];
|
||||
} else {
|
||||
return 0;
|
||||
|
@@ -29,7 +29,7 @@ class ChangepasswordRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
|
||||
'change_password' => 'required',
|
||||
// 'message' => 'required',
|
||||
];
|
||||
|
@@ -5,6 +5,7 @@ namespace App\Http\Requests\helpdesk;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
|
||||
/**
|
||||
* CompanyRequest.
|
||||
*
|
||||
@@ -29,12 +30,11 @@ class ClientRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$check = $this->check(new CommonSettings());
|
||||
$check = $this->check(new CommonSettings);
|
||||
if ($check != 0) {
|
||||
return $check;
|
||||
$custom_rule = $this->getCustomRule();
|
||||
$rules = array_merge($check, $custom_rule);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
$current_rule = [
|
||||
@@ -45,83 +45,70 @@ class ClientRequest extends Request
|
||||
];
|
||||
$custom_rule = $this->getCustomRule();
|
||||
$rules = array_merge($current_rule, $custom_rule);
|
||||
|
||||
return $rules;
|
||||
|
||||
}
|
||||
|
||||
public function getHelpTopic()
|
||||
{
|
||||
|
||||
public function getHelpTopic(){
|
||||
$help_topics = new \App\Model\helpdesk\Manage\Help_topic();
|
||||
$topic = $this->input('helptopic');
|
||||
$help_topic = $help_topics->where('id', $topic)->first();
|
||||
|
||||
$help_topic = $help_topics->where('id',$topic)->first();
|
||||
return $help_topic;
|
||||
}
|
||||
|
||||
public function getCustomRule()
|
||||
{
|
||||
$custom_form = '';
|
||||
|
||||
public function getCustomRule(){
|
||||
$custom_form = "";
|
||||
$help_topic = $this->getHelpTopic();
|
||||
if ($help_topic) {
|
||||
if($help_topic){
|
||||
$custom_form = $help_topic->custom_form;
|
||||
|
||||
}
|
||||
|
||||
return $this->getForm($custom_form);
|
||||
}
|
||||
|
||||
public function getForm($formid)
|
||||
{
|
||||
$id = '';
|
||||
|
||||
public function getForm($formid){
|
||||
$id = "";
|
||||
$forms = new \App\Model\helpdesk\Form\Forms();
|
||||
$form = $forms->where('id', $formid)->first();
|
||||
if ($form) {
|
||||
$form = $forms->where('id',$formid)->first();
|
||||
if($form){
|
||||
$id = $form->id;
|
||||
|
||||
}
|
||||
|
||||
return $this->getFields($id);
|
||||
}
|
||||
|
||||
public function getFields($formid)
|
||||
{
|
||||
|
||||
public function getFields($formid){
|
||||
$rules = [];
|
||||
$field = new \App\Model\helpdesk\Form\Fields();
|
||||
$fields = $field->where('forms_id', $formid)->get();
|
||||
if ($fields->count() > 0) {
|
||||
foreach ($fields as $fd) {
|
||||
if ($fd->required === '1') {
|
||||
$rules[str_replace(' ', '_', $fd->name)] = 'required';
|
||||
$fields = $field->where('forms_id',$formid)->get();
|
||||
if($fields->count()>0){
|
||||
foreach($fields as $fd){
|
||||
if($fd->required==='1'){
|
||||
$rules[str_replace(" ",'_',$fd->name)]="required";
|
||||
}
|
||||
$rules = array_merge($rules, $this->getChild($fd->id));
|
||||
$rules = array_merge($rules,$this->getChild($fd->id));
|
||||
}
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function getChild($fieldid)
|
||||
{
|
||||
|
||||
public function getChild($fieldid){
|
||||
$children = new \App\Model\helpdesk\Form\FieldValue();
|
||||
$childs = $children->where('field_id', $fieldid)->get();
|
||||
$childs = $children->where('field_id',$fieldid)->get();
|
||||
$rules = [];
|
||||
if ($childs->count() > 0) {
|
||||
foreach ($childs as $child) {
|
||||
if($childs->count()>0){
|
||||
foreach($childs as $child){
|
||||
$child_formid = $child->child_id;
|
||||
|
||||
return $this->getForm($child_formid);
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
*@category Funcion to set rule if send opt is enabled
|
||||
*
|
||||
*@param object $settings (instance of Model common settings)
|
||||
*
|
||||
*@param Object $settings (instance of Model common settings)
|
||||
*@author manish.verma@ladybirdweb.com
|
||||
*
|
||||
*@return array|int
|
||||
*@return array|int
|
||||
*/
|
||||
public function check($settings)
|
||||
{
|
||||
|
@@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
/**
|
||||
* CreateTicketRequest.
|
||||
*
|
||||
@@ -21,16 +18,14 @@ class CreateTicketRequest extends Request
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function wantsJson()
|
||||
{
|
||||
if (in_array('api', $this->segments())) {
|
||||
if(in_array('api',$this->segments())){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
@@ -38,15 +33,14 @@ class CreateTicketRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$check = $this->check(new CommonSettings());
|
||||
$check = $this->check(new CommonSettings);
|
||||
if ($check != 0) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
return [
|
||||
'email' => 'required|email|max:60',
|
||||
'email' => 'required|email|max:60',
|
||||
'first_name' => 'required|min:3|max:40',
|
||||
'helptopic' => 'required',
|
||||
'helptopic' => 'required',
|
||||
// 'dept' => 'required',
|
||||
'sla' => 'required',
|
||||
'subject' => 'required|min:5',
|
||||
@@ -54,15 +48,11 @@ class CreateTicketRequest extends Request
|
||||
'priority' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*@category Funcion to set rule if send opt is enabled
|
||||
*
|
||||
*@param object $settings (instance of Model common settings)
|
||||
*
|
||||
*@param Object $settings (instance of Model common settings)
|
||||
*@author manish.verma@ladybirdweb.com
|
||||
*
|
||||
*@return array|int
|
||||
*@return array|int
|
||||
*/
|
||||
public function check($settings)
|
||||
{
|
||||
@@ -71,9 +61,9 @@ class CreateTicketRequest extends Request
|
||||
// dd($settings->status, $email_mandatory->status);
|
||||
if (($settings->status == '1' || $settings->status == 1) && ($email_mandatory->status == '1' || $email_mandatory->status == 1)) {
|
||||
return [
|
||||
'email' => 'required|email|max:60',
|
||||
'email' => 'required|email|max:60',
|
||||
'first_name' => 'required|min:3|max:40',
|
||||
'helptopic' => 'required',
|
||||
'helptopic' => 'required',
|
||||
// 'dept' => 'required',
|
||||
'sla' => 'required',
|
||||
'subject' => 'required|min:5',
|
||||
@@ -86,11 +76,9 @@ class CreateTicketRequest extends Request
|
||||
return 0;
|
||||
} elseif (($settings->status == '0' || $settings->status == 0) && ($email_mandatory->status == '0' || $email_mandatory->status == 0)) {
|
||||
$rule = $this->onlyMobleRequired();
|
||||
|
||||
return $rule;
|
||||
} elseif (($settings->status == '1' || $settings->status == 1) && ($email_mandatory->status == '0' || $email_mandatory->status == 0)) {
|
||||
$rule = $this->onlyMobleRequired();
|
||||
|
||||
return $rule;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -99,17 +87,15 @@ class CreateTicketRequest extends Request
|
||||
|
||||
/**
|
||||
*@category function to make only moble required rule
|
||||
*
|
||||
*@param null
|
||||
*
|
||||
*@return array
|
||||
*/
|
||||
public function onlyMobleRequired()
|
||||
{
|
||||
return [
|
||||
'email' => 'email|max:60',
|
||||
'email' => 'email|max:60',
|
||||
'first_name' => 'required|min:3|max:40',
|
||||
'helptopic' => 'required',
|
||||
'helptopic' => 'required',
|
||||
// 'dept' => 'required',
|
||||
'sla' => 'required',
|
||||
'subject' => 'required|min:5',
|
||||
@@ -119,4 +105,4 @@ class CreateTicketRequest extends Request
|
||||
'mobile' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,15 +4,14 @@ namespace App\Http\Requests\helpdesk\Job;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class TaskRequest extends Request
|
||||
{
|
||||
class TaskRequest extends Request {
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
public function authorize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,28 +20,27 @@ class TaskRequest extends Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
public function rules() {
|
||||
return [
|
||||
'fetching-commands' => 'required_if:email_fetching,1',
|
||||
'fetching-commands' => 'required_if:email_fetching,1',
|
||||
'notification-commands' => 'required_if:notification_cron,1',
|
||||
'work-commands' => 'required_if:condition,1',
|
||||
'workflow-dailyAt' => 'required_if:work-commands,dailyAt',
|
||||
'notification-dailyAt' => 'required_if:notification-commands,dailyAt',
|
||||
'fetching-dailyAt' => 'required_if:fetching-commands,dailyAt',
|
||||
'work-commands' => 'required_if:condition,1',
|
||||
'workflow-dailyAt' => 'required_if:work-commands,dailyAt',
|
||||
'notification-dailyAt' => 'required_if:notification-commands,dailyAt',
|
||||
'fetching-dailyAt' => 'required_if:fetching-commands,dailyAt',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages()
|
||||
{
|
||||
public function messages() {
|
||||
return [
|
||||
'fetching-commands.required_if' => 'Please choose your Email Fetching timing',
|
||||
'notification-commands.required_if' => 'Please choose your Email Notification timing',
|
||||
'work-commands.required_if' => 'Please choose your Auto-close Workflow timing',
|
||||
'workflow-dailyAt.required_if' => 'Please enter the time for Auto-close Workflow timing',
|
||||
'notification-dailyAt.required_if' => 'Please enter the time for Email Notification timing',
|
||||
'fetching-dailyAt.required_if' => 'Please enter the time for Email Fetching timing',
|
||||
|
||||
'fetching-commands.required_if' => 'Please choose your Email Fetching timing',
|
||||
'notification-commands.required_if'=>'Please choose your Email Notification timing',
|
||||
'work-commands.required_if'=>'Please choose your Auto-close Workflow timing',
|
||||
'workflow-dailyAt.required_if'=>'Please enter the time for Auto-close Workflow timing',
|
||||
'notification-dailyAt.required_if'=>'Please enter the time for Email Notification timing',
|
||||
'fetching-dailyAt.required_if'=>'Please enter the time for Email Fetching timing',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
40
app/Http/Requests/helpdesk/LableUpdate.php
Normal file
40
app/Http/Requests/helpdesk/LableUpdate.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Model\helpdesk\Filters\Label;
|
||||
|
||||
/**
|
||||
* AgentUpdate.
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class LableUpdate extends Request
|
||||
{
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
$label_data = \Request::segments();
|
||||
$label = Label::find($label_data[1]);
|
||||
return [
|
||||
'title' => 'required|max:10|unique:labels,title,'.$label->id,
|
||||
'color' => 'required|regex:/#([a-fA-F0-9]{3}){1,2}\b/',
|
||||
'order' => 'required|integer'
|
||||
];
|
||||
}
|
||||
}
|
@@ -23,56 +23,52 @@ class MailRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
|
||||
$id = $this->segment(2);
|
||||
$email_address_rule = 'required|email|unique:emails';
|
||||
if ($id) {
|
||||
if($id){
|
||||
$email_address_rule = 'required|email|unique:emails,id,'.$id;
|
||||
}
|
||||
|
||||
$rules = [
|
||||
'email_address' => $email_address_rule,
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
'sending_protocol' => 'required_if:sending_status,on',
|
||||
|
||||
|
||||
$rules = [
|
||||
'email_address' => $email_address_rule,
|
||||
'email_name' => 'required',
|
||||
'password' => 'required',
|
||||
'sending_protocol'=>'required_if:sending_status,on',
|
||||
];
|
||||
$driver = $this->input('sending_protocol');
|
||||
$driver_rules = $this->getDriver($driver);
|
||||
$rules = array_merge($rules, $driver_rules);
|
||||
|
||||
$rules = array_merge($rules,$driver_rules);
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function getDriver($serviceid)
|
||||
{
|
||||
|
||||
public function getDriver($serviceid){
|
||||
$rules = [];
|
||||
$mail_services = new \App\Model\MailJob\MailService();
|
||||
$mail_service = $mail_services->find($serviceid);
|
||||
if ($mail_service) {
|
||||
if($mail_service){
|
||||
$short = $mail_service->short_name;
|
||||
$rules = $this->getRules($short);
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function getRules($short)
|
||||
{
|
||||
|
||||
public function getRules($short){
|
||||
$rules = [];
|
||||
switch ($short) {
|
||||
case 'mailgun':
|
||||
$rules = [
|
||||
'domain' => 'required',
|
||||
'secret' => 'required',
|
||||
switch ($short){
|
||||
case "mailgun":
|
||||
$rules = [
|
||||
'domain'=>'required',
|
||||
'secret'=>'required',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
case 'mandrill':
|
||||
$rules = [
|
||||
'secret' => 'required',
|
||||
case "mandrill":
|
||||
$rules = [
|
||||
'secret'=>'required',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
default:
|
||||
default :
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
@@ -29,14 +29,18 @@ class PriorityRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
|
||||
|
||||
'priority' => 'required|max:10',
|
||||
'status' => 'required',
|
||||
'priority_desc' => 'required|max:255',
|
||||
'priority_color' => 'required',
|
||||
'ispublic' => 'required',
|
||||
'priority_successfully_updated'=>'priority successfully updated',
|
||||
'priority_successfully_created!!!'=>'priority successfully created',
|
||||
|
||||
|
||||
|
||||
'priority' => 'required|max:10',
|
||||
'status' => 'required',
|
||||
'priority_desc' => 'required|max:255',
|
||||
'priority_color' => 'required',
|
||||
'ispublic' => 'required',
|
||||
'priority_successfully_updated' => 'priority successfully updated',
|
||||
'priority_successfully_created!!!' => 'priority successfully created',
|
||||
|
||||
];
|
||||
}
|
||||
|
@@ -36,8 +36,8 @@ class ProfileRequest extends Request
|
||||
}
|
||||
|
||||
/**
|
||||
*Check the mobile number is unique or not.
|
||||
*
|
||||
*Check the mobile number is unique or not
|
||||
*@return string
|
||||
*/
|
||||
public function checkMobile()
|
||||
|
@@ -25,19 +25,16 @@ class QueueRequest extends Request
|
||||
{
|
||||
$request = $this->except('_token');
|
||||
$rules = $this->setRule($request);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
public function setRule($request)
|
||||
{
|
||||
|
||||
public function setRule($request){
|
||||
$rules = [];
|
||||
if (count($request) > 0) {
|
||||
foreach ($request as $key => $value) {
|
||||
$rules[$key] = 'required';
|
||||
if(count($request)>0){
|
||||
foreach($request as $key=>$value){
|
||||
$rules[$key]='required';
|
||||
}
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
@@ -29,11 +29,10 @@ class RegisterRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$check = $this->check(new CommonSettings());
|
||||
$check = $this->check(new CommonSettings);
|
||||
if ($check != 0) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
return [
|
||||
'email' => 'required|max:50|email|unique:users',
|
||||
'full_name' => 'required',
|
||||
@@ -44,12 +43,9 @@ class RegisterRequest extends Request
|
||||
|
||||
/**
|
||||
*@category Funcion to set rule if send opt is enabled
|
||||
*
|
||||
*@param object $settings (instance of Model common settings)
|
||||
*
|
||||
*@param Object $settings (instance of Model common settings)
|
||||
*@author manish.verma@ladybirdweb.com
|
||||
*
|
||||
*@return array|int
|
||||
*@return array|int
|
||||
*/
|
||||
public function check($settings)
|
||||
{
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
|
||||
/**
|
||||
* Sys_userRequest.
|
||||
@@ -28,28 +28,24 @@ class Sys_userRequest extends Request
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$check = $this->check(new CommonSettings());
|
||||
{
|
||||
$check = $this->check(new CommonSettings);
|
||||
if ($check != 0) {
|
||||
return $check;
|
||||
}
|
||||
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'required|unique:users,email',
|
||||
'mobile' => 'unique:users',
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'required|unique:users,email',
|
||||
'mobile' => 'unique:users',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
*@category Funcion to set rule if send opt is enabled
|
||||
*
|
||||
*@param object $settings (instance of Model common settings)
|
||||
*
|
||||
*@param Object $settings (instance of Model common settings)
|
||||
*@author manish.verma@ladybirdweb.com
|
||||
*
|
||||
*@return array|int
|
||||
*@return array|int
|
||||
*/
|
||||
public function check($settings)
|
||||
{
|
||||
@@ -57,21 +53,19 @@ class Sys_userRequest extends Request
|
||||
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
|
||||
if (($settings->status == '1' || $settings->status == 1) && ($email_mandatory->status == '1' || $email_mandatory->status == 1)) {
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'required|unique:users,email',
|
||||
'country_code' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'required|unique:users,email',
|
||||
'country_code' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
];
|
||||
} elseif (($settings->status == '0' || $settings->status == 0) && ($email_mandatory->status == '1' || $email_mandatory->status == 1)) {
|
||||
return 0;
|
||||
} elseif (($settings->status == '0' || $settings->status == 0) && ($email_mandatory->status == '0' || $email_mandatory->status == 0)) {
|
||||
$rule = $this->onlyMobleRequired();
|
||||
|
||||
return $rule;
|
||||
} elseif (($settings->status == '1' || $settings->status == 1) && ($email_mandatory->status == '0' || $email_mandatory->status == 0)) {
|
||||
$rule = $this->onlyMobleRequired();
|
||||
|
||||
return $rule;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -80,19 +74,17 @@ class Sys_userRequest extends Request
|
||||
|
||||
/**
|
||||
*@category function to make only moble required rule
|
||||
*
|
||||
*@param null
|
||||
*
|
||||
*@return array
|
||||
*/
|
||||
public function onlyMobleRequired()
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'unique:users,email',
|
||||
'country_code' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name',
|
||||
'email' => 'unique:users,email',
|
||||
'country_code' => 'required',
|
||||
'mobile' => 'required|unique:users',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Requests\helpdesk;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
//use Illuminate\Http\Request as Req;
|
||||
/**
|
||||
* Sys_userUpdate.
|
||||
@@ -30,10 +29,10 @@ class Sys_userUpdate extends Request
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name,'.$this->segment(2),
|
||||
'email' => 'required|email|unique:users,email,'.$this->segment(2),
|
||||
'mobile' => 'unique:users,mobile,'.$this->segment(2),
|
||||
'first_name' => 'required',
|
||||
'user_name' => 'required|min:3|unique:users,user_name,'.$this->segment(2),
|
||||
'email' => 'required|email|unique:users,email,'.$this->segment(2),
|
||||
'mobile' => 'unique:users,mobile,'.$this->segment(2),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -9,15 +9,14 @@ use App\Http\Requests\Request;
|
||||
*
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class TicketRequest extends Request
|
||||
{
|
||||
class TicketRequest extends Request {
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
public function authorize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,42 +25,39 @@ class TicketRequest extends Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$error = '';
|
||||
public function rules() {
|
||||
$error = "";
|
||||
try {
|
||||
$size = $this->size();
|
||||
if ($size > 800 || $size == 0) {
|
||||
throw new \Exception('File size exceeded', 422);
|
||||
if ($size > 800 || $size==0) {
|
||||
throw new \Exception("File size exceeded", 422);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
dd($ex);
|
||||
$error = $this->error($ex);
|
||||
$error = $this->error($ex);
|
||||
}
|
||||
// return [
|
||||
// 'attachment' => 'not_in:'.$error,
|
||||
// ];
|
||||
}
|
||||
|
||||
public function size()
|
||||
{
|
||||
|
||||
public function size() {
|
||||
$files = $this->file('attachment');
|
||||
if (!$files) {
|
||||
throw new \Exception('exceeded', 422);
|
||||
}
|
||||
throw new \Exception("exceeded", 422);
|
||||
}
|
||||
$size = 0;
|
||||
if (count($files) > 0) {
|
||||
foreach ($files as $file) {
|
||||
$size += $file->getSize();
|
||||
$size +=$file->getSize();
|
||||
}
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
public function error($e)
|
||||
{
|
||||
public function error($e) {
|
||||
if ($this->ajax() || $this->wantsJson()) {
|
||||
|
||||
$message = $e->getMessage();
|
||||
if (is_object($message)) {
|
||||
$message = $message->toArray();
|
||||
@@ -70,4 +66,5 @@ class TicketRequest extends Request
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ class CategoryRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$id = $this->segment(2);
|
||||
|
||||
return [
|
||||
'name' => 'required|max:250|unique:kb_category,name,'.$id,
|
||||
'description' => 'required',
|
||||
|
@@ -24,9 +24,8 @@ class PageRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$slug = $this->segment(2);
|
||||
|
||||
return [
|
||||
'name' => 'required|unique:kb_pages,slug,'.$slug,
|
||||
'name' => 'required|unique:kb_pages,slug,'.$slug
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user