public function getCourse($coursecode) { $course = Course::where('c_code', 'LIKE', "%{$coursecode}%")->first(); if (!$course) { abort(404); } $notes = Note::where('course_id', $course->id)->orderBy('created_at', 'desc')->paginate(4); return view('course.index')->with('course', $course)->with('notes', $notes); }
public function getProfile($fullname) { $user = User::where(DB::raw("CONCAT(first_name, ' ', last_name)"), 'LIKE', "%{$fullname}%")->first(); if (!$user) { abort(404); } $notes = Note::where('user_id', $user->id)->orderBy('created_at', 'desc')->paginate(4); return view('profile.index')->with('mainuser', $user)->with('notes', $notes); }
public function index() { if (Auth::check()) { $courses = Course::all(); $notes = Note::where(function ($query) { return $query->where('user_id', Auth::user()->id)->orWhereIn('user_id', Auth::user()->whoIFollow()->lists('follow_id')); })->orderBy('created_at', 'desc')->paginate(4); return view('timeline.index')->with('mainuser', Auth::user())->with('courses', $courses)->with('notes', $notes); } return view('home'); }