<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


Route::group(['prefix' => 'v1' , 'namespace' => 'WebHook' ],function(){
    
// Route::group(['middleware'=>['CheckCode']],function(){
    Route::post('/myfatoorah/webhook', 'WebhookController@myfatoorah');
// });
    
    Route::post('webhook', 'WebhookController@webhook');
    
    Route::group(['prefix'=>'categories'],function (){
        Route::post('/create', 'CategoryController@create');
        Route::put('/update/{category_id}', 'CategoryController@update');
        Route::delete('/{category_id}', 'CategoryController@destroy');
        Route::put('{category_id}/restore', 'CategoryController@restore');
    });

    Route::group(['prefix'=>'groups'],function (){
        Route::post('/create', 'GroupController@create');
        Route::put('/update/{group_id}', 'GroupController@update');
        Route::delete('/{group_id}', 'GroupController@destroy');
        Route::put('{group_id}/restore', 'GroupController@restore');
    });
    
    Route::group(['prefix'=>'products'],function (){
        Route::post('/create', 'ProductController@create');
        Route::put('/update/{product_id}', 'ProductController@update');
        Route::delete('/{product_id}', 'ProductController@destroy');
        Route::put('/{product_id}/restore', 'ProductController@restore');
    });

    Route::group(['prefix'=>'tables'],function (){
        Route::post('/create', 'TableController@create');
        Route::put('/update/{table_id}', 'TableController@update');
        Route::delete('/{table_id}', 'TableController@destroy');
        Route::put('/{table_id}/restore', 'TableController@restore');
    });

});
