Laravel Show Data On Bootstrap Modal Tutorial

Hello Artisan

in this pass data to modal laravel brand new tutorial, i will show you laravel show data on bootstrap modal from scratch. We will send ajax get request and then we will show data in modal laravel with pop up.

If you don't know how to get data in modal laravel, then this tutorial is perfect example for you. I will use bootstrap modal and ajax request to show data in modal with pop up. You will be clear to complete this how to display data in modal popup laravel tutorial. 

Let's start our tutorail of how to show data in laravel with modal tutorial.

 

Step 1 : Create Route

In this step we need to create route for creating show data with bootstarp modal. So create it.

routes/web.php

Route::get('/', 'TestController@index')->name('root');
Route::get('/color/{id}/edit', 'TestController@update')->name('color.update');

 

Step 2 : Create Controller 

In this step we have to create test controller. So create it and then paste this below code to create show data with modal in laravel.

app/Http/Controllers/TestController.php

namespace App\Http\Controllers;

use App\Category;
use Illuminate\Http\Request;

class TestController extends Controller
{
    public function index()
    {   
    	$category = Category::all();
    	return view('home',compact('lija'));
    }

    public function update($id)
    {
    	$category = Category::find($id);

	    return response()->json([
	      'data' => $category
	    ]);
    }
}

 

Step 3 : Create View

Now in this final step we have to create our home.blade.php. so create it and paste this below code with modal.

resources/views/home.blade.php

 

Read also : Edit Data with Bootstrap Modal Window in Laravel

 

Hope it can help you.

 

#laravel #laravel-8x #modal #jquery