public function update(TweetRequest $request, Tweet $tweet)
 {
     try {
         $tweet->update($request->all());
         return response()->json(['errors' => 'false', 'message' => 'The project has been updated!']);
     } catch (\Exception $e) {
         return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
     }
 }
示例#2
0
 public function reply_store(TweetRequest $request)
 {
     $input = $request->all();
     $tweet = new Tweet($input);
     $tweet->tweet_id = 0;
     $tweet->original_tweet_id = Input::get('original_tweet_id');
     $tweet->country_id = Input::get('country_id');
     Auth::user()->tweets()->save($tweet);
     $notification = new RepostNotification();
     $notification->user_id = Auth::user()->id;
     $notification->my_user_id = Tweet::find($tweet->original_tweet_id)->user->id;
     $notification->tweet_id = $tweet->original_tweet_id;
     $notification->type = "Reply";
     $notification->reply_id = $tweet->id;
     $notification->save();
     return redirect('/');
 }
 /**
  * Handle Initial Form Request and return Response
  *
  * @param TweetRequest $request
  * @return Response
  */
 public function request(TweetRequest $request)
 {
     $data = $request->all();
     /**
      * Check Target is allowed
      */
     if (!$this->valid($data['tweet_target'])) {
         return response()->json(['code' => 403, 'status' => 'disabled', 'message' => 'This target is disabled.']);
     }
     /**
      * Register Sender / Target
      */
     $data['tweet_sender'] = $this->sender($request);
     $data['tweet_target'] = $this->target($data['tweet_target']);
     /**
      * Kitten Filter
      */
     $censor = $this->censor($data['tweet_message']);
     $data = array_merge($data, $censor);
     return $this->queue($data);
 }