Exemplo n.º 1
0
 public function destroy(TicketType $ticket_type)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $ticket_type->delete();
     return redirect('/configuration#ticket')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 2
0
 public function destroy(Department $department)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $department->delete();
     return redirect('/configuration#department')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 3
0
 public function destroy(BusinessHour $business_hour)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $business_hour->delete();
     return redirect('/configuration#business_hour')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 4
0
 public function destroy(ServiceTime $service_time)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $service_time->delete();
     return redirect('/configuration#service_time')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 5
0
 public function destroy(Role $role)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     if ($role->name == 'admin') {
         return redirect('/configuration#permission')->withErrors(config('constants.INVALID_LINK'));
     }
     $role->delete();
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 6
0
 public function destroy(CustomField $custom_field)
 {
     if (!Entrust::can('manage_custom_field')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $custom_field->delete();
     $activity = 'Deleted a Custome Field';
     Activity::log($activity);
     return redirect('/custom_field')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 7
0
 public function destroy(Attachment $attachment)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     if ($attachment->user_id != Auth::user()->id && !Entrust::hasRole('admin')) {
         return redirect()->back()->withErrors(config('constants.INVALID_LINK'));
     }
     $belongs_to = $attachment->belongs_to;
     File::delete('uploads/attachment_files/' . $attachment->file);
     $attachment->delete($id);
     $activity = 'Deleted a file on a ' . $belongs_to;
     Activity::log($activity);
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 8
0
 public function destroy($key)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     if (!Entrust::can('manage_template')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     $templates = Helper::getTemplate();
     if (!array_key_exists($key, $templates)) {
         return redirect()->back()->withErrors(config('constants.NA'));
     }
     if ($templates[$key]['category'] == 'system') {
         return redirect()->back()->withErrors('This template cannot be deleted.');
     }
     unset($templates[$key]);
     $filename = base_path() . '/config/template/' . DOMAIN . '/' . $key;
     if (File::exists($filename)) {
         File::delete($filename);
     }
     $filename = base_path() . '/config/template.php';
     File::put($filename, var_export($templates, true));
     File::prepend($filename, '<?php return ');
     File::append($filename, ';');
     return redirect()->back()->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 9
0
 public function destroy(Annoucement $annoucement)
 {
     if (!Entrust::can('delete_annoucement')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     Helper::deleteCustomField($this->form, $annoucement->id);
     $annoucement->delete();
     $activity = 'Deleted a annoucement';
     Activity::log($activity);
     return redirect('/annoucement')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 10
0
 public function destroy(Ticket $ticket)
 {
     if (!Entrust::can('delete_ticket')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     Helper::deleteCustomField($this->form, $ticket->id);
     $ticket_no = $ticket->ticket_no;
     $ticket->delete();
     $activity = 'Deleted a ticket # ' . $ticket_no;
     Activity::log($activity);
     return redirect('/ticket')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 11
0
 public function store(Request $request)
 {
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $config = Helper::getConfiguration();
     $config_type = $request->input('config_type');
     $input = $request->all();
     foreach ($input as $key => $value) {
         if ($key != '_token' && $key != 'config_type') {
             $config[$key] = $value;
         }
     }
     if ($request->input('next_ticket_no')) {
         $max_ticket_no = \App\Ticket::max('ticket_no');
         if (isset($max_ticket_no) && $request->input('next_ticket_no') < $max_ticket_no) {
             return redirect()->back()->withErrors('Next ticket number cannot be less than existing ticket number.');
         }
     }
     $filename = base_path() . config('paths.CONFIG_PATH');
     File::put($filename, var_export($config, true));
     File::prepend($filename, '<?php return ');
     File::append($filename, ';');
     return redirect('/configuration#' . $config_type)->withSuccess(config('constants.SAVED'));
 }
Exemplo n.º 12
0
 public function destroy($id)
 {
     if (!Entrust::can('manage_language')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $languages = Helper::getAllLanguages();
     if (!array_key_exists($id, $languages)) {
         return redirect()->back()->withErrors(config('constants.INVALID_LINK'));
     }
     if ($id == 'en') {
         return redirect('/language')->withErrors('You cannot delete primary language.');
     }
     if (config('config.default_language') == $id) {
         return redirect('/language')->withErrors('This language is currently default language of system, Please change system language.');
     }
     $result = File::deleteDirectory(base_path() . '/resources/lang/' . $id);
     unset($languages[$id]);
     $filename = base_path() . config('paths.LANG_PATH');
     File::put($filename, var_export($languages, true));
     File::prepend($filename, '<?php return ');
     File::append($filename, ';');
     $activity = 'Deleted a Language';
     Activity::log($activity);
     return redirect('/language')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 13
0
 public function destroy(Holiday $holiday)
 {
     if (!Entrust::can('delete_holiday')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     Helper::deleteCustomField($this->form, $holiday->id);
     $holiday->delete();
     return redirect('/holiday')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 14
0
 public function delete($id, $token)
 {
     if (!Entrust::can('manage_message')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::verifyCsrf($token)) {
         return redirect('/dashboard')->withErrors(config('constants.CSRF'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     $message = Message::find($id);
     if (!$message || $message->to_user_id != Auth::user()->id && $message->from_user_id != Auth::user()->id) {
         return redirect('/message')->withErrors(config('constants.INVALID_LINK'));
     }
     if ($message->to_user_id == Auth::user()->id) {
         $message->delete_receiver = 1;
     } else {
         $message->delete_sender = 1;
     }
     $message->save();
     return redirect('/message')->withSuccess(config('constants.DELETED'));
 }
Exemplo n.º 15
0
 public function destroy(User $user)
 {
     if (!Entrust::can('delete_user')) {
         return redirect('/dashboard')->withErrors(config('constants.NA'));
     }
     if (!Helper::getMode()) {
         return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
     }
     if ($user->id == Auth::user()->id) {
         return redirect('/user')->withErrors('You cannot delete yourself. ');
     }
     Helper::deleteCustomField($this->form, $user->id);
     $user->delete();
     return redirect('/user')->withSuccess(config('constants.DELETED'));
 }