Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ trim_trailing_whitespace = true
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
indent_size = 4
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files": ["*.php"],
"tabWidth": 4,
"useTabs": true
}
81 changes: 39 additions & 42 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,46 @@

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'password',
'password_confirmation',
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = ['password', 'password_confirmation'];

/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}
/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
parent::report($exception);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
}
12 changes: 12 additions & 0 deletions app/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Http\Controllers;

use App\Traits\ApiResponser;
use Illuminate\Http\Request;

// como todas las clases heredan de esta, todas heredan Controller::class
class ApiController extends Controller
{
use ApiResponser;
}
11 changes: 7 additions & 4 deletions app/Http/Controllers/Buyer/BuyerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace App\Http\Controllers\Buyer;

use App\Http\Controllers\Controller;
use App\Buyer;
use App\Http\Controllers\ApiController;
use Illuminate\Http\Request;

class BuyerController extends Controller
class BuyerController extends ApiController
{
/**
* Display a listing of the resource.
Expand All @@ -14,7 +15,8 @@ class BuyerController extends Controller
*/
public function index()
{
//
/* return response()->json(['data' => Buyer::has('transaction')->get()],200); */
return $this->showAll(Buyer::has('transaction')->get());
}

/**
Expand Down Expand Up @@ -46,7 +48,8 @@ public function store(Request $request)
*/
public function show($id)
{
//
/* return response()->json(['data'=>Buyer::has('transaction')->findOrFail($id)],200); */
return $this->showOne(Buyer::has('transaction')->findOrFail($id));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Category/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers\Category;

use App\Http\Controllers\Controller;
use App\Http\Controllers\ApiController;
use Illuminate\Http\Request;

class CategoryController extends Controller
class CategoryController extends ApiController
{
/**
* Display a listing of the resource.
Expand Down
6 changes: 2 additions & 4 deletions app/Http/Controllers/Product/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers\Product;

use App\Http\Controllers\Controller;
use App\Http\Controllers\ApiController;
use Illuminate\Http\Request;

class ProductController extends Controller
class ProductController extends ApiController
{
/**
* Display a listing of the resource.
Expand All @@ -14,7 +14,6 @@ class ProductController extends Controller
*/
public function index()
{
//
}

/**
Expand Down Expand Up @@ -46,7 +45,6 @@ public function store(Request $request)
*/
public function show($id)
{
//
}

/**
Expand Down
11 changes: 7 additions & 4 deletions app/Http/Controllers/Seller/SellerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace App\Http\Controllers\Seller;

use App\Http\Controllers\Controller;
use App\Http\Controllers\ApiController;
use App\Seller;
use Illuminate\Http\Request;

class SellerController extends Controller
class SellerController extends ApiController
{
/**
* Display a listing of the resource.
Expand All @@ -14,7 +15,8 @@ class SellerController extends Controller
*/
public function index()
{
//
/* return response()->json(['data'=>Seller::has('product')->get()],200); */
return $this->showAll(Seller::has('product')->get());
}

/**
Expand Down Expand Up @@ -46,7 +48,8 @@ public function store(Request $request)
*/
public function show($id)
{
//
/* return response()->json(['data'=>Seller::has('product')->findOrFail($id)],200); */
return $this->showOne(Seller::has('product')->findOrFail($id));
}

/**
Expand Down
Loading