<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Category;
use App\Models\Azienda;

class BK_CategoryController extends Controller
{
    public function index()
    {
        $categories = Categorie::all(); //join aziende
        $aziende = Azienda::all();
        return view('backend.categories.index', compact('categories', 'aziende'));
    }

    public function create()
    {
        return view('backend.categories.create');
    }

    public function store(Request $request)
    {
        //
        //
    }

    public function show(Categorie $category)
    {
        return view('backend.categories.show', compact('category'));
    }

    public function edit(Categorie $category)
    {
        return view('backend.categories.edit', compact('category'));
    }

    public function update(Request $request, Categorie $category)
    {
        $category->update($request->all());
        return redirect()->route('categories.index');
    }

    public function destroy(Categorie $category)
    {
        $category->delete();
        return redirect()->route('categories.index');
    }
}
