Posts

Country and State table with Insert Operation in Database in Laravel 11

Image
  <?php namespace App\Http\Controllers ; use App\Models\ Country ; use Illuminate\Http\ Request ; use Illuminate\Support\Facades\ DB ; class CountryController extends Controller {     public function index ()     {         $country = DB :: table ( "country" )-> get ();         return view ( "country" , [ "data" => $country ]);     }     public function showCountry ()     {         $country = DB :: table ( "country" )-> get ();         return view ( "countryHome" , [ "data" => $country ]);     }     public function validateCountry ( Request $request )     {         if ( $request -> validate ([             "countryName" => "required" ,             "countryCode" => "required|unique:country,country_code"...