public function dashboard() { /** * Log the user out if not admin */ if (auth()->user()->is_admin == 0) { auth()->logout(); return redirect()->to('/login')->withErrors(['email' => 'Only admin is allowed']); } $appUsers = User::count(); $ambassadors = Ambassador::count(); $subscribedUsers = UserSubscription::GroupBy('user_id')->count(); $news = Feed::where('is_deleted', 0)->where('type', 1)->count(); $videos = \DB::table('videos')->join('video_categories', 'video_categories.id', '=', 'videos.video_category_id')->where('videos.is_deleted', 0)->where('video_categories.type', 1)->count(); $scholarships = Feed::where('is_deleted', 0)->where('type', 2)->count(); $sat_act = Feed::where('is_deleted', 0)->where('type', 3)->count(); //$coachesCorner = Feed::where('is_deleted', 0)->where('type', 4)->count(); $meals = Meal::where('is_deleted', 0)->count(); $weightTraining = \DB::table('videos')->join('video_categories', 'video_categories.id', '=', 'videos.video_category_id')->where('videos.is_deleted', 0)->where('video_categories.type', 2)->count(); $schedules = WorkoutSchedule::where('is_deleted', 0)->count(); $items = Item::where('is_deleted', 0)->count(); return view('dashboard', compact('appUsers', 'ambassadors', 'subscribedUsers', 'news', 'videos', 'scholarships', 'sat_act', 'meals', 'weightTraining', 'schedules', 'items')); }
public function deleteFeed($id) { $Feed = Feed::find($id); Article::where('feed_id', $id)->delete(); Feed::where('id', $id)->delete(); return response()->json('deleted'); }
public function deleteUrl(Request $request) { $this->validate($request, ['id' => 'required|numeric']); Feed::where('id', '=', $request->id)->delete(); return response()->json([], 200); }
/** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function spamFeeds() { $feeds = Feed::where('is_spam', '1')->where('is_deleted', 0)->paginate(env('LIMIT', 15)); return view('feeds.spam', compact('feeds')); }