public function create(array $data) { try { $this->validator->with($data)->passesOrFail(); return $this->repository->create($data); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->GetMessageBag()]; } }
public function create(array $data) { try { $this->validator->with($data)->passesOrFail(); return $this->repository->create($data); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } //enviar um email //disparar notificação //postar um tweet }
/** * @param $request * @return array|mixed */ public function store($request) { try { return $this->repository->create($request); } catch (ValidatorException $e) { return ['error' => true, 'message' => $e->getMessageBag()]; } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { return $this->service->create($request->all()); }