public function overview() { $data['inbox_count'] = Email::where('user_id', Auth::id())->where('box_id', 1)->count(); //todo: if you want to write articles, contact us $articles = Article::where('user_id', Auth::id())->orderBy('id', 'asc')->get(); $sites = Auth::user()->sites()->get(); $professions = Auth::user()->professions()->get(); $classifieds = Classified::where('user_id', Auth::id())->orderBy('id', 'desc')->get(); return view('dashboard.overview', compact('data', 'articles', 'sites', 'professions', 'classifieds')); }
/** * @param $city_id * @param $category_id * * @return int */ static function CityAddsCount($city_id, $category_id = null) { if ($category_id) { $count = Classified::where('classifieds.city_id', $city_id)->where('classifieds.category_id', $category_id)->count(); } else { $count = Classified::where('classifieds.city_id', $city_id)->count(); } if ($count) { return "({$count})"; } return '<span class="light-grey">(' . $count . ')</span>'; }
/** * Execute the Command */ public function handle() { return Classified::where('id', $this->id)->update(['title' => $this->title, 'category_id' => $this->category_id, 'description' => $this->description, 'price' => $this->price, 'condition' => $this->condition, 'main_image' => $this->main_image, 'location' => $this->location, 'email' => $this->email, 'phone' => $this->phone]); }
/** * Sbow all adds in a city * * @param $slug * @param $id * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showCity($slug, $id) { $city = City::whereId($id)->first(); $categories = ClassifiedCategory::orderBy('id')->get(); $items = Classified::where('city_id', $id)->orderBy('publish_at', 'desc')->get(); return view('classifieds.classified_city', compact('city', 'categories', 'items')); }