Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function destroy(Request $request)
- {
- //
- try {
- //code...
- $validator = Validator::make($request->all(), [
- 'id' => 'required|numeric',
- 'id_user' => 'required|numeric',
- ]);
- if ($validator->fails()) {
- return $this->getResponse(406, $validator->errors()->first());
- }
- $transactions = Transactions::where('id', $request->id)->where('id_user', $request->id_user)->first();
- if ($transactions) {
- # code...
- $transactions->delete();
- return $this->getResponse(200);
- }
- else {
- return $this->getResponse(404);
- }
- } catch (\Throwable $th) {
- //throw $th;
- return $this->getResponse(500, $th);
- }
- }
Add Comment
Please, Sign In to add comment