<?php

namespace App\Http\Controllers;

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

class CompanyController extends Controller
{
    public function store(Request $request)
    {
        $request->validate([
            'name' => 'required|string|max:255|unique:companies,name',
            'address' => 'nullable|string',
            'phone' => 'nullable|string|max:50',
            'email' => 'nullable|email|max:100'
        ]);
        
        Company::create($request->all());
        
        return redirect()->back()->with('success', 'কোম্পানি সফলভাবে যোগ করা হয়েছে');
    }
}