/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['description' => 'required', 'cost' => 'required|numeric']);
     $model = Services::find($id);
     $model->update(['description' => $request->input('description'), 'cost' => $request->input('cost')]);
     \Toastr::success('You edited a service', 'Success');
     return redirect('/services');
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'starts_at' => 'required', 'ends_at' => 'required', 'scope' => 'required', 'type' => 'required']);
     //
     // dd($request->all(), strtotime($request->input('starts_at')));
     $event = Events::create(['title' => $request->input('title'), 'description' => $request->input('description'), 'starts_at' => date('Y-m-d H:i:s', strtotime($request->input('starts_at'))), 'ends_at' => date('Y-m-d H:i:s', strtotime($request->input('ends_at'))), 'scope' => $request->input('scope'), 'type' => $request->input('type')]);
     \Auth::user()->events()->save($event);
     \Toastr::success('You created an event', 'Success');
     return redirect('/events');
 }
Example #3
0
 public function completed(Request $request, Tasks $task, $completed)
 {
     $task->update(['completed' => $completed]);
     if ($task->isComplete() && $task->user_id !== $task->task_user_id) {
         event(new TaskWasCompleted($task));
     } else {
         if ($task->isComplete() && $task->task_user_id == auth()->id()) {
             \Toastr::success($task->subject, 'Task complete');
         }
     }
     return redirect()->back();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email']);
     $model = Customers::find($id);
     $model->update($request->except(['county', 'phone_numbers', 'display_name', 'address']));
     if ($request->wantsJson()) {
         return response()->json($model);
     }
     \Toastr::success('You edited a customer', 'Success');
     return redirect('/customers');
 }
 /**
  * Adds a new message to a current thread.
  *
  * @param $id
  * @return mixed
  */
 public function update($id)
 {
     try {
         $thread = Thread::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
         return redirect('messages');
     }
     $thread->activateAllParticipants();
     // Message
     Message::create(['thread_id' => $thread->id, 'user_id' => Auth::id(), 'body' => Input::get('message')]);
     // Add replier as a participant
     $participant = Participant::firstOrCreate(['thread_id' => $thread->id, 'user_id' => Auth::user()->id]);
     $participant->last_read = new Carbon();
     $participant->save();
     // Recipients
     if (Input::has('recipients')) {
         $thread->addParticipants(Input::get('recipients'));
     }
     event(new ThreadWasRepliedTo($thread));
     \Toastr::success('You have replied', $title = 'Success', ["showDuration" => "3000"]);
     return redirect('messages/' . $id);
 }
Example #6
0
 public function concretada($slug, $date, $id)
 {
     $cita = Cita::find($id);
     if ($cita->concretada == 1) {
         $cita->concretada = 0;
     } else {
         $cita->concretada = 1;
     }
     $cita->save();
     $medico = Medico::findBySlug($slug);
     $medico->especialidad;
     Toastr::success('Cita Concretada');
     return redirect()->route('admin.citas.show', ['slug' => $slug, 'date' => $date]);
 }