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!']); } }
/** * Register Sender * * @param TweetRequest $request * @return Integer $id */ private function sender(TweetRequest $request) { $sender['ip'] = $request->ip(); $sender['server'] = json_encode($request->server()); // Check if Sender exists and quit early $record = Senders::where('ip', $sender['ip']); if ($record->exists()) { return $record->first()->id; } $record = Senders::create($sender); return $record->id; }
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('/'); }