Exemplo n.º 1
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.º 2
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.º 3
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.º 4
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'));
 }