/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $biz = Biz::findorFail($id); $cat = $biz->cats->lists('id')->all(); $sub = $biz->subcats->lists('id')->all(); // dd($sub); $catList = Cat::lists('name', 'id'); $subList = SubCat::lists('name', 'id'); // dd($subList); $stateList = State::lists('name', 'id'); $lgaList = Lga::lists('name', 'id'); //$area= Address::lists //dd($biz->address->state->name); // foreach ($biz->subcats as $sub) { // $currentSubs[] = $sub->id; // } // if(empty($currentSubs)){ // $currentSubs = ''; // } return view('admin/biz/edit', compact('biz', 'catList', 'subList', 'stateList', 'cat', 'currentSubs', 'lgaList', 'sub')); }
public function profile($userId) { $cats = Cat::all(); $user = \App\User::findOrFail($userId); $bizs = $user->favours; $favourites = \DB::table('favourites')->whereUserId(\Auth::user()->id)->lists('biz_id'); //$bizs = Biz::orderBy('created_at', 'desc')->paginate(6); $stateList = State::lists('name', 'name'); $lgaList = Lga::lists('name', 'id'); $catList = Cat::lists('name', 'name'); $featured = Biz::whereFeatured('YES')->paginate(3); $recent = Biz::orderBy('created_at', 'desc')->paginate(2); // dd($featured); return view('pages.user-profile', compact('stateList', 'lgaList', 'catList', 'cats', 'bizs', 'user', 'favourites', 'featured', 'recent', 'totalBiz', 'totalCat')); }