ok

Mini Shell

Direktori : /home2/selectio/www/ecommerce-website/website/app/Http/Controllers/api/v1/
Upload File :
Current File : /home2/selectio/www/ecommerce-website/website/app/Http/Controllers/api/v1/CategoryController.php

<?php

namespace App\Http\Controllers\api\v1;

use App\CPU\CategoryManager;
use App\CPU\Helpers;
use App\Http\Controllers\Controller;
use App\Model\Category;

class CategoryController extends Controller
{
    public function get_categories()
    {
        try {
            $categories = Category::with(['childes.childes'])->where(['position' => 0])->priority()->get();
            return response()->json($categories, 200);
        } catch (\Exception $e) {
            return response()->json([], 200);
        }
    }

    public function get_products($id)
    {
        return response()->json(Helpers::product_data_formatting(CategoryManager::products($id), true), 200);
    }
}

Zerion Mini Shell 1.0