Esempio n. 1
0
 /**
  * Store a newly created resource in storage.
  * POST /posts
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::only('post');
     $this->postForm->validate($input);
     $post = new Post($input);
     $user = User::find(Auth::id());
     $post = $user->posts()->save($post);
     Flash::overlay('Post Success!', 'Good Job');
     return Redirect::back();
 }
Esempio n. 2
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 1000) as $index) {
         $genders = ['male', 'female'];
         $genders_key = array_rand($genders);
         $images_catagories = ['abstract', 'animals', 'business', 'cats', 'city', 'food', 'nightlife', 'fashion', 'people', 'nature', 'sports', 'technics', 'transport'];
         $images_catagories_key = array_rand($images_catagories);
         User::create(['email' => $faker->email, 'username' => $faker->userName . rand(1, 1000), 'password' => $faker->password, 'name' => $faker->name($genders[$genders_key]), 'gender' => $genders[$genders_key], 'location' => $faker->country, 'website' => 'http://www.' . $faker->domainName, 'bio' => $faker->realText, 'profile_pic' => $faker->imageUrl(700, 500, $images_catagories[$images_catagories_key]) . rand(1, 10)]);
     }
     User::create(['email' => '*****@*****.**', 'username' => 'test', 'password' => 'test', 'name' => 'Test Name', 'gender' => 'male', 'location' => 'Canada', 'website' => 'http://www.testdomain.com', 'bio' => 'This is a test bio', 'profile_pic' => 'http://lorempixel.com/700/500/people/8']);
 }
Esempio n. 3
0
 public function isFollowedBy(User $otherUser)
 {
     $idsWhoOtherUserFollows = $otherUser->following()->lists('followed_id');
     return in_array($this->id, $idsWhoOtherUserFollows);
 }
Esempio n. 4
0
 public function findById($id)
 {
     return User::findOrFail($id);
 }