/** * Load play video page * * @param $title * @return \Illuminate\Http\Response */ public function playVideo($title) { $recent = $this->recentVideos(); $categories = $this->getCategory(); $video = Video::where('slug', $title)->first(); $avatar = Avatar::whereUser_id($video->user_id)->first(); $video->avatar = $avatar->avatarURL; return view('pages.play', compact('categories', 'video', 'recent')); }
/** * Create a default avatar * * @param Request $request * @return \Illuminate\Support\Collection */ protected function createDefaultAvatar(Request $request) { $userID = User::where('username', $request->username)->first(); Avatar::create(['user_id' => $userID->id, 'avatarURL' => $request->avatar]); }
/** * Create Avatar * * @param $username * @param $url */ public function createAvatar($username, $url) { return Avatar::create(['user_id' => $this->getUserID($username), 'avatarURL' => $url]); }
/** * Insert avatar details to database * * @param Request $request * @return \Illuminate\Http\Response */ public function uploadAvatar(Request $request) { $imageURL = $this->getImageFileUrl($request->avatar); Avatar::where('user_id', $request->user_id)->update(['avatarURL' => $imageURL]); return redirect('/user/details'); }
/** * Create Avatar * * @return \Illuminate\Support\Collection */ public function createAvatar() { Avatar::create(['user_id' => 1, 'avatarURL' => 'asdada']); }