<?php

namespace App\Http\Controllers;

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

class TechnoTransportController extends Controller
{
    public function addTechnoTransport(Request $request)
    {
        $request->validate([
            'file' => 'required|mimes:doc,pdf,docx'
        ]);


        $file = $request->file('file')->store('technotransport');

        // $techno_transport = new TechnoTransport();
        $techno_transport = TechnoTransport::create($request->all());
        $techno_transport->file = $file;
        $techno_transport->save(); 

        return response()->json([
            'status' => 200,
            'data' => $techno_transport
        ]);
    }
}
