Esempio n. 1
0
 /**
  * @param Request $request
  * @param Entry   $entry
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function storeReply(Request $request, $entry)
 {
     $this->validate($request, EntryReply::rules());
     if (user()->isBanned($entry->group)) {
         return response()->json(['status' => 'error', 'error' => 'Użytkownik został zbanowany w wybranej grupie.'], 400);
     }
     $reply = new EntryReply();
     $reply->text = request('text');
     $reply->user()->associate(user());
     $entry->replies()->save($reply);
     return response()->json(['status' => 'ok', '_id' => $reply->getKey(), 'reply' => $reply]);
 }
Esempio n. 2
0
 protected function createFakeEntryReply(Entry $entry)
 {
     $entry->replies()->create(['created_at' => $this->faker->dateTimeThisDecade, 'text' => $this->faker->text(512), 'user_id' => $this->getRandomUser()->getKey()]);
 }