crud with modal in lravel

Solutions on MaxInterview for crud with modal in lravel by the best coders in the world

showing results for - "crud with modal in lravel"
Lya
25 May 2020
1<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
2	Open Form
3</button>
4
5<!-- Modal -->
6<div wire:ignore.self class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
7    <div class="modal-dialog" role="document">
8        <div class="modal-content">
9            <div class="modal-header">
10                <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
11                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
12                     <span aria-hidden="true close-btn">×</span>
13                </button>
14            </div>
15           <div class="modal-body">
16                <form>
17                    <div class="form-group">
18                        <label for="exampleFormControlInput1">Name</label>
19                        <input type="text" class="form-control" id="exampleFormControlInput1" placeholder="Enter Name" wire:model="name">
20                        @error('name') <span class="text-danger error">{{ $message }}</span>@enderror
21                    </div>
22                    <div class="form-group">
23                        <label for="exampleFormControlInput2">Email address</label>
24                        <input type="email" class="form-control" id="exampleFormControlInput2" wire:model="email" placeholder="Enter Email">
25                        @error('email') <span class="text-danger error">{{ $message }}</span>@enderror
26                    </div>
27                </form>
28            </div>
29            <div class="modal-footer">
30                <button type="button" class="btn btn-secondary close-btn" data-dismiss="modal">Close</button>
31                <button type="button" wire:click.prevent="store()" class="btn btn-primary close-modal">Save changes</button>
32            </div>
33        </div>
34    </div>
35</div>
Jan
12 Jun 2018
1<?php
2namespace App\Http\Controllers;
3use Illuminate\Http\Request;
4use App\Customer;
5use Redirect,Response;
6class CustomerController extends Controller
7{
8
9	/**
10	* Display a listing of the resource.
11	*
12	* @return \Illuminate\Http\Response
13	*/
14
15	public function index()
16	{
17		$customers = Customer::latest()->paginate(4);
18		return view('customers.index',compact('customers'))->with('i', (request()->input('page', 1) - 1) * 4);
19	}
20
21	/**
22	* Show the form for creating a new resource.
23	*
24	* @return \Illuminate\Http\Response
25	*/
26
27	public function create()
28	{
29		return view('customers.create');
30	}
31
32	/**
33	* Store a newly created resource in storage.
34	*
35	* @param \Illuminate\Http\Request $request
36	* @return \Illuminate\Http\Response
37	*/
38
39	public function store(Request $request)
40	{
41
42		$r=$request->validate([
43		'name' => 'required',
44		'email' => 'required',
45		'address' => 'required',
46		]);
47
48		$custId = $request->cust_id;
49		Customer::updateOrCreate(['id' => $custId],['name' => $request->name, 'email' => $request->email,'address'=>$request->address]);
50		if(empty($request->cust_id))
51			$msg = 'Customer entry created successfully.';
52		else
53			$msg = 'Customer data is updated successfully';
54		return redirect()->route('customers.index')->with('success',$msg);
55	}
56
57	/**
58	* Display the specified resource.
59	*
60	* @param int $id
61	* @return \Illuminate\Http\Response
62	*/
63
64	public function show(Customer $customer)
65	{
66		return view('customers.show',compact('customer'));
67	}
68
69	/**
70	* Show the form for editing the specified resource.
71	*
72	* @param int $id
73	* @return \Illuminate\Http\Response
74	*/
75	
76	public function edit($id)
77	{
78		$where = array('id' => $id);
79		$customer = Customer::where($where)->first();
80		return Response::json($customer);
81	}
82
83	/**
84	* Update the specified resource in storage.
85	*
86	* @param \Illuminate\Http\Request $request
87	* @param int $id
88	* @return \Illuminate\Http\Response
89	*/
90
91	public function update(Request $request)
92	{
93
94	}
95
96	/**
97	* Remove the specified resource from storage.
98	*
99	* @param int $id
100	* @return \Illuminate\Http\Response
101	*/
102
103	public function destroy($id)
104	{
105		$cust = Customer::where('id',$id)->delete();
106		return Response::json($cust);
107	}
108}
109
queries leading to this page
laravel livewire modals packagelaravel 8 crud modal popuphow to integrate laravel livewire with bootstraplivewire open bootstrap modallivewire install bootstraplivewire wire 3amodel in bootstrap modallivewire with bootstraplaravel 22livewire 22 modallivewire and bootstrap modal issueslivewire crud modal not displaying validation errorlivewire model popupajax modal laravelbootstrap modal call in livewirelaravel livewire bootstrap modallaravel crud with pop up modallaravel livewire load modal with data javascriptsimple laravel crud with modallaravel crud bootstrap modallivewire popuplivewire bootstrap modallaravel livewire medal in bootstrapmodal popup form group livewirelivewire bootstrapcrud with modal in lravelcrud laravel 8 modalpopup modal livewireshow and hide modal livewirelaravel livewire dynamic modallivewire edit with modal datatableeditar con modal laravel livewirelaravel livewire modal bootstraplaravel livewire modal exampleuse bootstrap with livewirelaravel 7 crud using modallivewire bootstrap modal problemimplement bootstrap modal in livewirelaravel modal crudlaravel livewire modal fade d blocklivewire modal examplelivewire bootstrap modal calllaravel 8 livewire modallaravel livewire open modalbootstrap js liveware laravelcrud with modal in 3blaravelajax laravel crud with popup modalmodal crud laravelopen bootstrap model livewirelaravel crud with popup modal trough jquerybootstrap modal laravel livewireload data to bootstrap modal livewirelaravel livewire bootstraplaravel livewire show modallaravel livewire with bootstrapcrud modal laravel 7open modal with livewire laravellaravel crud 3a bootstrap modalajax modal crud laravellivewire html modalslivewire create modal boxlivewire ui boostrap modallivewire modal component bootstrapuse bootstrap modal with livewireajax modal crud laravel 8livewire bootstrap modalslivewire after update in modallaravel crud using modalmodal with laravel livewirelaravel crud with popup modallivewire laravel popup packagelaravel livewire modal componentlaravel livewire crud modaldata table livewire with editable modallaravel 7 crud bootstrap modallivewire bootstrap modal clesed laravel livewire success modallaravel crud with modalmodal crud in laravellivewire show modallaravel livewire dynamic dropdown in bootstrap modallaravel livewire modal crud with comfire deletehow to view data on modal using livewirelivewire add recode by listener bootstarp modalcrud modal with laravel 7livewire add modal to modal stacklaravel modal data crudlaravel livewire modal showcrud with modal in laravel 6 jquerylaravel livewire open modal viewinstall bootstrap in livewirelaravel 8 livewire with bootstrapcrud modal laravel 8livewire crud modallaravel livewire events open modal in a tabmodal crud laravel 7laravel 7 crud modal with javascriptlaravel 8 bootstrap with livewireusing livewire modallaravel crud modal ajaxbootstrap 4 modal laravel livewirecrud modal laravelpopup livewire bootstraplivewire component for show modal by eventcrud users with livewire bootstraplaravel 8 livewire bootstrap installcrud modal ajax laravellaravel 8 modal crudimage popup livewirelivewire bootstrap jslivewire modal disappears when typinglivewire bootstrap cssbootstrap modal inside livewire componentmodal bootstrap with livewire componentlivewire popup laravelcrud laravel 8 using modals 26 ajaxlivewire button click open modalcrud with modal in laravelmodal crud form in laravellaravel crud bootstrap modal close buttonlivewire bootstrap uselaravel 8 livewire bootstraplaravel livewire modal formlaravel crud modallaravel bootstrap livewirelivewire bootstrap modal from componentlaravel crud example using modalslaravel livewire with bootstrap 5laravel livewire open bootstrap modallivewire crud bootstrapbootstrap livewirelaravel 7 crud modallaravel 7 crud modal boobootstrap modal livewireimplement bootstrap css in laravel with livewirelaravel install livewire bootstrapcrud with modal in laravel 6use livewire with bootstraplivewire popup modallaravel livewire popupliveware with bootstraplaravel livewire modalcrud with modal in lravel