/** * [postReturnRequest description] * * @param integer $id return_request_id * @return Redirect */ public function postReturnRequest($return_id) { $return = app('OrderRepo')->getReturnSchedule(['id' => $return_id, 'status' => 0]); $data = ['return' => $return]; \Mail::send('emails.return_schedule_confirm', $data, function ($message) use($return) { $user = $return['order']['user']; $message->to($user['email'], $user['name'])->subject('[ThankSpace] Confirmation return #' . GetLastInvoiceOrder($return['order']['id'])->code . ' di ThankSpace'); }); // update the return schedule \ReturnSchedule::where('id', $return_id)->update(['status' => 1]); return Redirect::route('admin.returnRequest')->withMessage(['success' => 'Return request telah sukses terkonfirmasi']); }
/** * Get returned stuff from return schedule * * @param array $option * @return \Illuminate\Database\Eloquent\Model */ public function getReturnedStuffs($id) { return \ReturnSchedule::with('order.orderPayment', 'order.user', 'stuffs')->find($id); }
/** * For assign return schedule for driver * * @param array $input * @return mix \Illuminate\Database\Eloquent\Model|false */ public function assignReturn(array $input = array()) { if (isset($input['return_schedule_id'])) { \ReturnSchedule::whereIn('id', $input['return_schedule_id'])->update(['user_id' => \Auth::user()->id]); return true; } else { $this->setErrors(['message' => ['ico' => 'meh', 'msg' => 'No schedule selected', 'type' => 'error']]); return false; } }