/** * static function to read the xls and store * * @param int $id * @return Response*/ public static function orderimport_xls($pathname, $camp_id, $campid, $description, $object_id) { $camp = Camp::findOrFail($camp_id); Excel::load($pathname, function ($reader) use($camp) { $results = $reader->get(); foreach ($results as $result) { $save['order_id'] = $result->order_id; $save['warehouse'] = $result->warehouse; $save['ship_date'] = date('Y-m-d H:i:s', strtotime($result->ship_date)); $save[$status] = $result->status; $save['order_amount'] = $result->order_amount; $save['actual_time_to_deliver'] = $result->actual_time_to_deliver; $save['payment_method'] = $result->payment_method; $save['associate'] = $result->associate; $save['address_type'] = $result->address_type; $save['address'] = $result->customer_name . ',' . $result->status . ',' . $result->city . ',' . $result->district . ',' . $result->province . ',' . $result->customer_phone; $save[$campid] = $camp->id; Order::create($save); Session::flash('success', Lang::get('ruban.camp.updated')); unset($save); } $timeline[$description] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the daily camp xls for <a href="javascript:;">' . $camp->title . '</a>'; $timeline[$object_type] = 5; $timeline[$object_id] = $camp->id; Timeline::create($timeline); }); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(ProjectRequest $request, $id) { $project = Project::find($id); if ($project) { $input = $request->except($this->image); $input['start_date'] = Carbon\Carbon::parse($request->get('start_date'))->format('Y-m-d'); $input['end_date'] = Carbon\Carbon::parse($request->get('end_date'))->format('Y-m-d'); $input[$this->image] = Project::upload_projectfile($request, $this->image, $project->image); $input['updated_by'] = Auth::user()->id; $project->fill($input); $project->save(); Session::flash($this->success, Lang::get('ruban.project.updated')); $timeline['object_type'] = 1; $timeline['object_id'] = $id; $timeline['action'] = 'update'; $timeline['description'] = '<a href="javascript:;">' . $input['name'] . '</a> project has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.'; Timeline::create($timeline); return Redirect::route('ruban.projects.index'); } else { Session::flash($this->danger, Lang::get('ruban.project.notfound')); return Redirect::route('ruban.projects.index'); } }
public function updatepartner(CardPartnerRequest $request, $id) { $input = $request->all(); $card = Card::FindORFail($id); $project = Project::FindORFail($card->project_id); $input['card_id'] = $id; PartnerCards::where('card_id', $id)->where('partner_id', $request->get('partner_id'))->delete(); PartnerCards::create($input); $user = User::find($input['partner_id']); $client = User::find(2); $data['email'] = $user->email; $data['name'] = $user->first_name . ' ' . $user->last_name; $data['content'] = $card->name . ' of the ' . $project->name . ' project has been assigned to you.'; Card::Mailing($data); $data1['email'] = $client->email; $data1['name'] = $client->first_name . ' ' . $client->last_name; $data1['content'] = $card->name . ' of the ' . $project->name . ' project has been assigned to ' . $data['name'] . ' Partner.'; Card::Mailing($data1); $timeline['object_type'] = 3; $timeline['object_id'] = $id; $timeline['action'] = 'assign'; $timeline['description'] = '<a href="javascript:;">' . $card->name . '</a> card has been assigned to ' . $user->first_name . ' ' . $user->last_name . ' by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.'; Timeline::create($timeline); Session::flash('success', Lang::get('ruban.partner.assigned')); return Redirect::route('ruban.cards.index'); }
/** * static function to read the xls and store * * @param int $id * @return Response*/ public static function import_xls($pathname, $card_id = false, $camp_id = false) { Excel::load($pathname, function ($reader) use($card_id, $camp_id) { // Getting all results $results = $reader->get(); $cnt = 1; foreach ($results as $result) { //checking existing Ditrict in db if ($cnt < 6) { if ($card_id) { $exitdist = Card::where('id', $card_id)->first(); } else { $exitdist = Card::where('name', $result->card)->first(); } if ($camp_id) { $camp = Camp::where('id', $camp_id)->first(); } else { $camp = Camp::where('name', $result->camp)->first(); } $save['card_id'] = @$exitdist->id; $save['camp_id'] = @$camp->id; $save['title'] = $result->title; $save['description'] = ' Order Id :' . $result->order_id . ', Ship date:' . $result->ship_date; $save['added_by'] = Auth::user()->id; $save['status'] = $result->status; $save['order_amount'] = $result->order_amount; $save['actual_time_to_deliver'] = $result->actual_time_to_deliver; $save['payment_method'] = $result->payment_method; $save['address_type'] = $result->address_type; $save['address'] = ' Customer_name:' . $result->customer_name . ', Status:' . $result->status . ', City:' . $result->city . ', District' . $result->district . ', Province' . $result->province . ', Customer Phone' . $result->customer_phone; Task::create($save); if (@$camp->title) { $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . $camp->title . '</a>'; $timeline['object_type'] = 6; $timeline['object_id'] = $camp->id; Timeline::create($timeline); } if (@$exitdist->name) { $timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . @$exitdist->name . '</a>'; $timeline['object_type'] = 6; $timeline['object_id'] = $exitdist->id; Timeline::create($timeline); } unset($save); } $cnt++; } }); }