Exemplo n.º 1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(StatusRepository $repository)
 {
     $status = Status::publish($this->body);
     $repository->save($status, $this->userId);
     event(new StatusWasPublished($status));
     return $status;
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $userIds = \App\Users\User::lists('id')->toArray();
     foreach (range(0, 500) as $index) {
         Status::create(['user_id' => $faker->randomElement($userIds), 'body' => $faker->sentence(), 'created_at' => $faker->dateTime()]);
     }
 }
Exemplo n.º 3
0
 /**
  * Get the feed for a user.
  *
  * @param User $user
  * @return mixed
  */
 public function getFeedForUser(User $user)
 {
     $userIds = $user->fallowedUsers()->lists('fallowed_id');
     $userIds[] = $user->id;
     return Status::with('comments')->whereIn('user_id', $userIds)->latest()->get();
 }