/** * Update the `is_closed` property. */ public function updateIsClosed() { $this->isClosing = false; $this->isReopening = false; // Don't do anything unless the status has changed if ($this->originalStatusId != $this['status_id']) { $status = Status::find($this['status_id']); // Did the status change to open/started or closed? if ($status->status >= 1) { // Reopen ticket if ($this['is_closed']) { $this->isClosing = false; $this->isReopening = true; } $this['is_closed'] = false; $this->isClosing = false; } elseif ($status->status == 0) { // Close ticket if (!$this['is_closed']) { $this->isClosing = true; } $this['is_closed'] = true; } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $status = Status::find($id); $status->delete(); Flash::message('Your status has been removed.'); return Redirect::back(); }
/** * Save ticket */ public function save() { // Set is_closed value based off status if ($status = Status::find($this->status_id)) { $this->is_closed = $status->is_closed; } return parent::save(); }
public function borrar_status() { $id = Input::get('idedit'); $status = Status::find($id); if ($status->delete()) { Session::flash('message', 'Eliminado correctamente'); Session::flash('class', 'success'); } else { Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente'); Session::flash('class', 'danger'); } return Redirect::to('status'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $status = Status::find($id); if ($status) { try { // Delete breed, if not possible, catch error. $status->delete(); } catch (Exception $e) { // If breed to be deleted is in use, send nice error back to admin. return Redirect::back()->with('message', FlashMessage::DisplayAlert('Status can NOT be deleted because it\'s in use.', 'alert')); } return Redirect::back()->with('message', FlashMessage::DisplayAlert('Status Deleted Successfully!', 'success')); } return Redirect::back()->with('message', FlashMessage::DisplayAlert('Record Not Found.', 'alert')); }
public function postEdit() { $validator = Validator::make(Input::all(), Status::$rules); $data = Input::all(); $status = Status::find(Input::get('id_status')); if (is_null($status)) { App::abort(404); } if ($validator->passes()) { $status->fill($data); $status->date = date("Y-m-d", strtotime(Input::get('date'))); $status->save(); return Redirect::to(Input::get('url') . '#' . $status->id)->with('confirmation', '¡Los datos fueron actualizados!'); } else { // validation has failed, display error messages return Redirect::to(Input::get('url') . '#formStatusEdit')->with('message-box', 'Debes corregir los siguientes campos:')->withErrors($validator)->withInput(); } }
/** * Remove the specified resource from storage. * DELETE /projectstatus/{id} * * @param int $id * @return Response */ public function destroy($id) { $status = Status::find($id)->delete(); if (is_null($status)) { $class = 'error'; $message = 'Record does not exist.'; } else { $class = 'success'; $message = 'Record successfully deleted.'; } return Redirect::route('project.status.index')->with('class', $class)->with('message', $message); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->status->find($id)->delete(); return Redirect::route('admin.tech_statuses.index'); }
/** * Update the specified resource in storage. * * @param [int] $id * @return [Response] */ public function update($id) { // Check if is_staff if (!$this->is_staff()) { Session::flash('alert_danger', 'Access denied.'); return Redirect::to('dashboard'); } else { try { // Organize Data $status_id = Input::get('status'); $status_arr = Status::find($status_id); $status = $status_arr["attributes"]["status"]; // Save Loan $loan = Loan::find($id); $loan->status_id = $status_id; $loan->save(); // Save Transaction $transaction = new Transaction(); $transaction->loan_id = $id; $transaction->user_id = $this->user->id; $transaction->transaction_type_id = "2"; $transaction->updated_item_id = $id; $transaction->transaction_description = "Loan Status updated to " . $status; $transaction->save(); } catch (\RuntimeException $e) { Session::flash('alert_danger', 'Failed to update loan.'); return Redirect::to('loan/' . $id); } Session::flash('alert_success', 'Updated loan successfully.'); return Redirect::to('loan/' . $id); } }
public function postUpdate() { $ruta = Status::find(Input::get('id')); $ruta->estado = Input::get('status'); $ruta->save(); }