Esempio n. 1
0
 static function createComment(User $recipient, User $poster, $content)
 {
     $shout = new Shout();
     $shout->setUserRelatedByPosterId($poster);
     $shout->setUserRelatedByRecipientId($recipient);
     $time = strtotime(date('Y-m-d H:i:s')) + 3120;
     $newTime = date('Y-m-d H:i:s', $time);
     $shout->setCreatedAt($newTime);
     $shout->setContent($content);
     $shout->save();
 }
Esempio n. 2
0
 /**
  * Ajoute un shout
  *
  * @access public
  * @return redirect /shoutbox
  */
 public function add()
 {
     $user = Auth::user();
     $shout = new Shout();
     $shout->content = Input::get('content');
     $shout->user_id = $user->id;
     $v = Validator::make($shout->toArray(), $shout->rules);
     if ($v->passes()) {
         $shout->save();
     } else {
     }
     return Redirect::route('shoutbox');
 }