<?php

namespace App\Http\Controllers;

use App\Http\Requests\PackingSlipRequest;
use App\Models\Customer;
use App\Models\PackingSlip;
use Illuminate\Http\Request;

class PackingSlipController extends Controller
{
    public function index() {}

    public function create() {}

    public function store(PackingSlipRequest $request)
    {
        PackingSlip::create($request->validated());

        if ($request->get('from_customer')) {
            return redirect()->route('customers.show', [
                Customer::find($request->get('customer_id')),
                'tab' => 'packing',
            ]);
        }

        return redirect()->back(); //todo: change to packing slips page
    }

    public function show($id) {}

    public function edit($id) {}

    public function update(Request $request, $id) {}

    public function destroy($id) {}
}