/** * Display a listing of the resource. */ public function index() { if (\Auth::user() && \Auth::user()->profile->city_id != null) { $questions = Question::where('city_id', '=', \Auth::user()->profile->city_id)->orderBy('id', 'desc')->paginate(5); return view('questions::index', compact('questions')); } else { $questions = Question::orderBy('id', 'desc')->paginate(5); return view('questions::index', compact('questions')); } }
/** * Display a listing of the resource. */ public function index() { $questions = Question::orderBy('id', 'desc')->paginate(5); return view('admin.questions.index', ['questions' => $questions]); }