Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $v = Validator::make(Request::all(), ['interest_in' => 'required|max:50|unique:interests']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $interest = new Interest();
         $interest->interest_in = Request::get('interest_in');
         $interest->save();
         return redirect('interests');
     }
 }
Ejemplo n.º 2
0
 public function update(Interest $interest, InterestUpdateRequest $request)
 {
     $interest->update($request->all());
     $default_image = '/images/' . Auth::user()->email . '/lord.png';
     if (Input::hasFile('image_1')) {
         $image_1 = Input::file('image_1');
         $filename = $interest->id . 'FirstImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_1->getRealPath())->save($path);
         $interest->image_1 = '/images/' . Auth::user()->email . '/' . $filename;
         $image_1_thumb = Input::file('image_1');
         $filename = $interest->id . 'Thumb-FirstImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_1_thumb->getRealPath())->resize(400, null, function ($constraint) {
             $constraint->aspectRatio();
         })->save($path);
         $interest->image_1_thumb = '/images/' . Auth::user()->email . '/' . $filename;
     }
     if (Input::hasFile('image_2')) {
         $image_2 = Input::file('image_2');
         $filename = $interest->id . 'SecondImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_2->getRealPath())->save($path);
         $interest->image_2 = '/images/' . Auth::user()->email . '/' . $filename;
         $image_2_thumb = Input::file('image_2');
         $filename = $interest->id . 'Thumb-SecondImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_2_thumb->getRealPath())->resize(400, null, function ($constraint) {
             $constraint->aspectRatio();
         })->save($path);
         $interest->image_2_thumb = '/images/' . Auth::user()->email . '/' . $filename;
     }
     if (Input::hasFile('image_3')) {
         $image_3 = Input::file('image_3');
         $filename = $interest->id . 'ThirdImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_3->getRealPath())->save($path);
         $interest->image_3 = '/images/' . Auth::user()->email . '/' . $filename;
         $image_3_thumb = Input::file('image_3');
         $filename = $interest->id . 'Thumb-ThirdImage.jpg';
         $path = public_path('/images/' . Auth::user()->email . '/' . $filename);
         Image::make($image_3_thumb->getRealPath())->resize(400, null, function ($constraint) {
             $constraint->aspectRatio();
         })->save($path);
         $interest->image_3_thumb = '/images/' . Auth::user()->email . '/' . $filename;
     }
     if (strpos($interest->video_1, "pornhub") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://www.pornhub.com/embed/" . $video_1_id;
     } elseif (strpos($interest->video_1, "cliphunter") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://www.cliphunter.com/embed/" . $video_1_id;
     } elseif (strpos($interest->video_1, "youporn") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://www.youporn.com/embed/" . $video_1_id;
     } elseif (strpos($interest->video_1, "youjizz") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://www.youjizz.com/videos/embed/" . $video_1_id;
     } elseif (strpos($interest->video_1, "xvideos") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://flashservice.xvideos.com/embedframe/" . $video_1_id;
     } elseif (strpos($interest->video_1, "xhamster") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://xhamster.com/xembed.php?video=" . $video_1_id;
     } elseif (strpos($interest->video_1, "tube8") !== false) {
         $video_1_id = preg_replace('/\\D/', '', $interest->video_1);
         $interest->video_1 = "http://xhamster.com/xembed.php?video=" . $video_1_id;
     } elseif (strpos($interest->video_1, "spankwire") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://www.spankwire.com/EmbedPlayer.aspx?ArticleId=" . $video_1_id;
     } elseif (strpos($interest->video_1, "redtube") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_1, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_1_id = $matches[$index];
         }
         $interest->video_1 = "http://embed.redtube.com/?id=" . $video_1_id . "&bgcolor=000000";
     } else {
         if (in_array("1", $request->input('tag_list'))) {
             $videos = Tag::find(1)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("2", $request->input('tag_list'))) {
             $videos = Tag::find(2)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("3", $request->input('tag_list'))) {
             $videos = Tag::find(3)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("4", $request->input('tag_list'))) {
             $videos = Tag::find(4)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("5", $request->input('tag_list'))) {
             $videos = Tag::find(5)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("6", $request->input('tag_list'))) {
             $videos = Tag::find(6)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("7", $request->input('tag_list'))) {
             $videos = Tag::find(7)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         } elseif (in_array("8", $request->input('tag_list'))) {
             $videos = Tag::find(8)->videos;
             $thevideo = $videos->random();
             $interest->video_1 = $thevideo->htmlembedcode;
         }
     }
     //Video 2
     if (strpos($interest->video_2, "pornhub") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://www.pornhub.com/embed/" . $video_2_id;
     } elseif (strpos($interest->video_2, "cliphunter") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://www.cliphunter.com/embed/" . $video_2_id;
     } elseif (strpos($interest->video_2, "youporn") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://www.youporn.com/embed/" . $video_2_id;
     } elseif (strpos($interest->video_2, "youjizz") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://www.youjizz.com/videos/embed/" . $video_2_id;
     } elseif (strpos($interest->video_2, "xvideos") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://flashservice.xvideos.com/embedframe/" . $video_2_id;
     } elseif (strpos($interest->video_2, "xhamster") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://xhamster.com/xembed.php?video=" . $video_2_id;
     } elseif (strpos($interest->video_2, "tube8") !== false) {
         $video_2_id = preg_replace('/\\D/', '', $interest->video_2);
         $interest->video_2 = "http://xhamster.com/xembed.php?video=" . $video_2_id;
     } elseif (strpos($interest->video_2, "spankwire") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://www.spankwire.com/EmbedPlayer.aspx?ArticleId=" . $video_2_id;
     } elseif (strpos($interest->video_2, "redtube") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_2, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_2_id = $matches[$index];
         }
         $interest->video_2 = "http://embed.redtube.com/?id=" . $video_2_id . "&bgcolor=000000";
     } else {
         if (in_array("1", $request->input('tag_list'))) {
             $videos = Tag::find(1)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("2", $request->input('tag_list'))) {
             $videos = Tag::find(2)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("3", $request->input('tag_list'))) {
             $videos = Tag::find(3)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("4", $request->input('tag_list'))) {
             $videos = Tag::find(4)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("5", $request->input('tag_list'))) {
             $videos = Tag::find(5)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("6", $request->input('tag_list'))) {
             $videos = Tag::find(6)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("7", $request->input('tag_list'))) {
             $videos = Tag::find(7)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         } elseif (in_array("8", $request->input('tag_list'))) {
             $videos = Tag::find(8)->videos;
             $thevideo = $videos->random();
             $interest->video_2 = $thevideo->htmlembedcode;
         }
     }
     //video 3...probably need to abstract this later...
     if (strpos($interest->video_3, "pornhub") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://www.pornhub.com/embed/" . $video_3_id;
     } elseif (strpos($interest->video_3, "cliphunter") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://www.cliphunter.com/embed/" . $video_3_id;
     } elseif (strpos($interest->video_3, "youporn") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://www.youporn.com/embed/" . $video_3_id;
     } elseif (strpos($interest->video_3, "youjizz") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://www.youjizz.com/videos/embed/" . $video_3_id;
     } elseif (strpos($interest->video_3, "xvideos") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://flashservice.xvideos.com/embedframe/" . $video_3_id;
     } elseif (strpos($interest->video_3, "xhamster") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://xhamster.com/xembed.php?video=" . $video_3_id;
     } elseif (strpos($interest->video_3, "tube8") !== false) {
         $video_3_id = preg_replace('/\\D/', '', $interest->video_3);
         $interest->video_3 = "http://xhamster.com/xembed.php?video=" . $video_3_id;
     } elseif (strpos($interest->video_3, "spankwire") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://www.spankwire.com/EmbedPlayer.aspx?ArticleId=" . $video_3_id;
     } elseif (strpos($interest->video_3, "redtube") !== false) {
         if (preg_match_all('/\\d+/', $interest->video_3, $numbers)) {
             $matches = $numbers[0];
             $lengths = array_map('strlen', $matches);
             $maxlength = max($lengths);
             $index = array_search($maxlength, $lengths);
             $video_3_id = $matches[$index];
         }
         $interest->video_3 = "http://embed.redtube.com/?id=" . $video_3_id . "&bgcolor=000000";
     } else {
         if (in_array("1", $request->input('tag_list'))) {
             $videos = Tag::find(1)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("2", $request->input('tag_list'))) {
             $videos = Tag::find(2)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("3", $request->input('tag_list'))) {
             $videos = Tag::find(3)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("4", $request->input('tag_list'))) {
             $videos = Tag::find(4)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("5", $request->input('tag_list'))) {
             $videos = Tag::find(5)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("6", $request->input('tag_list'))) {
             $videos = Tag::find(6)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("7", $request->input('tag_list'))) {
             $videos = Tag::find(7)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         } elseif (in_array("8", $request->input('tag_list'))) {
             $videos = Tag::find(8)->videos;
             $thevideo = $videos->random();
             $interest->video_3 = $thevideo->htmlembedcode;
         }
     }
     $interest->save();
     flash()->overlay('Interest successfully updated');
     return redirect('interests');
 }
 public function postInterest(Request $request)
 {
     $user = $request->user();
     $interest = new Interest();
     $interest->user_id = $user->id;
     $interest->property_id = $request->property_id;
     $interest->is_confirmed = FALSE;
     $interest->save();
     return redirect('properties/search');
 }