public function store(CreateExpenseRequest $request) { $expense = $this->expenseService->save($request->input()); Session::flash('message', trans('texts.created_expense')); return redirect()->to("expenses/{$expense->public_id}/edit"); }
/** * @SWG\Post( * path="/expenses", * tags={"expense"}, * summary="Create a expense", * @SWG\Parameter( * in="body", * name="body", * @SWG\Schema(ref="#/definitions/Expense") * ), * @SWG\Response( * response=200, * description="New expense", * @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Expense")) * ), * @SWG\Response( * response="default", * description="an ""unexpected"" error" * ) * ) */ public function store(CreateExpenseRequest $request) { $expense = $this->expenseRepo->save($request->input()); $expense = Expense::scope($expense->public_id)->with('client', 'invoice', 'vendor')->first(); return $this->itemResponse($expense); }