Exemple #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function delete($id)
 {
     $user = User::find($id);
     $user->house = '[DISABLED-' . date('Y-m-d H:i:s') . ']' . $user->house;
     $user->email = '[DISABLED-' . date('Y-m-d H:i:s') . ']' . $user->email;
     $user->status = 'DISABLED';
     $user->save();
     $payments = Payment::get_payments_from_user($user->id);
     $specialFee = SpecialFee::where('user_id', $id)->where('status', 'ENABLED');
     if ($specialFee != null) {
         $specialFee->user_status = 'DISABLED';
         // $specialFee->save();
     }
     foreach ($payments as $payment) {
         $payment->user_status = 'DISABLED';
         $payment->save();
     }
     return redirect(route('admin.users'));
 }
 public function delete($id)
 {
     $specialFee = SpecialFee::find($id);
     $specialFee->delete();
     return redirect(route('admin'));
 }