<?php

namespace App\Http\Controllers;

use App\Models\Industry;
use Illuminate\Http\Request;

use function PHPUnit\Framework\isEmpty;

class IndustryController extends Controller
{
    public function __invoke()
    {
        $about = Industry::all();

        if ($about->isEmpty()) {
            return response()->json(['message' => 'No record found'], 404);
        }

        return $about->makeHidden(['created_at', 'updated_at']);
    }

    public function by_id(string $id)
    {
        $about = Industry::find($id);

        if ($about) {
            $slider = Industry::select('id', 'name', 'mini_description', 'icon')
                ->get();
            $about->slider_industry = $slider;
            return $about->makeHidden(['id', 'created_at', 'updated_at']);
        } else {
            return response()->json(['message' => 'No record found'], 404);
        }
    }
    
}
