<?php

namespace App\Http\Controllers\md;

use App\Http\Controllers\Controller;
use App\Models\Location;
use Illuminate\Http\Request;

class LocatinController extends Controller
{
    //
    public function allLocation() {
        $allLocations = Location::all();
        return view('md.location.all_locations', compact('allLocations'));
    }

    public function addLocation() {
        return view('md.location.add_location');
    }

    public function storeLocation(Request $request) {
        $validateData = $request->validate([
            'name' => 'required'
           ]);
           $storeLocation = new Location;
           $storeLocation->name = $request->name;
           $storeLocation->size = $request->size;
           $storeLocation->save();
           return redirect()->route('all.location')->with('success', 'Project Added Successfully');

    }
}
