/** * Send User to Oauth URL */ public function connect($provider_name, $redir) { session(['oauth_redir' => $redir]); try { $provider = Provider::where('provider_safe_name', '=', $provider_name)->firstOrFail(); } catch (ModelNotFoundException $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; exit; } return Socialite::driver($provider_name)->redirect(); }
private function _update($id, $name, $parent_key, $ordinal, $active) { try { $data = ['name' => $name, 'parent_key' => $parent_key, 'ordinal' => $ordinal, 'active' => $active]; $affectedRows = Provider::where('id', '=', $id)->update($data); if ($affectedRows) { $this->message = 'Sửa nhà cung cấp thành công'; } else { $this->error_message = 'Error !'; $this->error = true; } } catch (Exception $e) { $this->error_message = $e->getMessage(); $this->error = true; } return $data; }
/** * Show the application dashboard to the user. * * @return Response */ public function index($slug) { $explodeSlug = explode('-', $slug); $brandId = explode('.', end($explodeSlug))[0]; if (!$brandId) { return false; } $obj = new Product(); $AllparentID = Provider::where('parent_key', $brandId)->get()->toArray(); $idPr = []; if ($AllparentID) { foreach ($AllparentID as $val) { array_push($idPr, $val['id']); } $res = Product::whereIn('provider_id', $idPr)->orderBy('id', 'desc'); } else { $res = Product::where('provider_id', $brandId)->orderBy('id', 'desc'); } $res = $this->paging($res, $this->req, false); $brandName = Provider::find($brandId); $data = ['title' => 'Nhãn hiệu', 'brand_name' => $brandName->name, 'product' => $res, 'total' => $this->total, 'total_page' => $this->total_page]; return View::make('user/brand', $data); }
public function update(ProviderRequest $request, $id) { $inputs = $request->input(); $file = $request->file('picture'); $destinationPath = base_path() . '/public/image/provider/'; if ($request->hasFile('picture')) { $name = time() . $file->getClientOriginalName(); $file->move($destinationPath, $name); $inputs['picture'] = $name; } $inputs['updated_by'] = Auth::user()->id; $inputs['updated_at'] = time(); unset($inputs['_method']); unset($inputs['_token']); Provider::where(['id' => $id])->update($inputs); Session::flash('flash_message', 'Product & Service Provider updated successfully'); return redirect('providers'); }
private function getProviderShowInIndex() { $ListProvider = Provider::where('active', 1)->where('parent_key', 0)->with(['Child' => function ($query) { return $query->orderBy('ordinal', 'ASC'); }])->orderBy('ordinal', 'ASC'); return $ListProvider->get(); }
public function getProviders() { $providers = Provider::where('status', 1)->lists('name', 'id'); $dropdown = view('ajaxView.providerDropDown')->with('providers', $providers)->render(); return response()->json($dropdown); }