| @@ -3,42 +3,39 @@ | ||
| 3 | 3 | namespace FluentSupport\App\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use FluentSupport\App\Http\Requests\ProductRequest; |
| 6 | 6 | use FluentSupport\App\Models\Product; |
| 7 | -use FluentSupport\Framework\Request\Request; | |
| 7 | +use FluentSupport\Framework\Http\Request\Request; | |
| 8 | 8 | |
| 9 | 9 | class ProductController extends Controller |
| 10 | 10 | { |
| 11 | 11 | /** |
| 12 | - * index method will return the list of product | |
| 13 | 12 | * @param Request $request |
| 14 | 13 | * @param Product $product |
| 15 | 14 | * @return array |
| 16 | 15 | */ |
| 17 | - public function index ( Request $request, Product $product ) | |
| 16 | + public function index( Request $request, Product $product ) | |
| 18 | 17 | { |
| 19 | 18 | return $product->getProducts( $request->getSafe('search', 'sanitize_text_field') ); |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | - * get method will get product by id and return | |
| 24 | 22 | * @param Product $product |
| 25 | 23 | * @param int $product_id |
| 26 | 24 | * @return array |
| 27 | 25 | */ |
| 28 | - public function get ( Product $product, $product_id ) | |
| 26 | + public function get( Product $product, $product_id ) | |
| 29 | 27 | { |
| 30 | 28 | return $product->getProduct( $product_id ); |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | 31 | /** |
| 34 | - * creare method will create new product | |
| 35 | - * @param Request $request | |
| 32 | + * @param ProductRequest $request | |
| 36 | 33 | * @param Product $product |
| 37 | 34 | * @return array |
| 38 | 35 | * @throws \FluentSupport\Framework\Validator\ValidationException |
| 39 | 36 | */ |
| 40 | - public function create ( ProductRequest $request, Product $product ) | |
| 37 | + public function create( ProductRequest $request, Product $product ) | |
| 41 | 38 | { |
| 42 | 39 | $data = $request->all(); |
| 43 | 40 | |
| 44 | 41 | return $product->createProduct( $data ); |
| @@ -45,16 +42,15 @@ | ||
| 45 | 42 | } |
| 46 | 43 | |
| 47 | 44 | |
| 48 | 45 | /** |
| 49 | - * update methd will update an exiting product by id | |
| 50 | - * @param Request $request | |
| 46 | + * @param ProductRequest $request | |
| 51 | 47 | * @param Product $product |
| 52 | 48 | * @param int $product_id |
| 53 | 49 | * @return array |
| 54 | 50 | * @throws \FluentSupport\Framework\Validator\ValidationException |
| 55 | 51 | */ |
| 56 | - public function update ( ProductRequest $request, Product $product, $product_id ) | |
| 52 | + public function update( ProductRequest $request, Product $product, $product_id ) | |
| 57 | 53 | { |
| 58 | 54 | $data = $request->all(); |
| 59 | 55 | |
| 60 | 56 | return $product->updateProduct( $product_id, $data ); |
| @@ -60,14 +56,13 @@ | ||
| 60 | 56 | return $product->updateProduct( $product_id, $data ); |
| 61 | 57 | } |
| 62 | 58 | |
| 63 | 59 | /** |
| 64 | - * delete method will delete an existing product by id | |
| 65 | 60 | * @param Product $product |
| 66 | 61 | * @param int $product_id |
| 67 | 62 | * @return array |
| 68 | 63 | */ |
| 69 | - public function delete ( Product $product, $product_id ) | |
| 64 | + public function delete( Product $product, $product_id ) | |
| 70 | 65 | { |
| 71 | 66 | return $product->deleteProduct( $product_id ); |
| 72 | 67 | } |
| 73 | 68 | } |