public function handle(SaveSocialSettings $command) { if (Buttons::where('user_id', $command->actor->id)->exists()) { $Buttons = Buttons::where('user_id', $command->actor->id)->first(); } else { $Buttons = new Buttons(); } $Buttons->user_id = $command->actor->id; $Buttons->Buttons = $command->Buttons; $this->events->fire(new SocialProfileEditted($command->actor, $command->Buttons)); $Buttons->save(); return $Buttons; }
public function findOrFail($id) { return Buttons::where('user_id', $id)->first(); }