//web.php
Route::post('/contact-bulk-action',[ContactController::class,'bulkAction'])->name('contact.bulkAction');
//_Controller.php
public function bulkAction(IlluminateHttpRequest $request){
Contact::destroy($request->contact_ids);
return redirect()->back();
}
//_.blade.php
<form action="{{route('contact.bulkAction')}}" id="bulk_action" method="post">
@csrf
</form>
<ul class="list-group">
@forelse($contacts as $contact)
<li class="list-group-item d-flex justify-content-between align-items-center">
<div class="">
<div class="form-check">
<input type="checkbox" form="bulk_action" name="contact_ids[]" value="{{$contact->id}}" id="contact{{ $contact->id }}">
<label for="contact{{ $contact->id }}">
{{$contact->name}}
</label>
</div>
</div>
</li>
@empty
<li>
There is no data
</li>
@endforelse
</ul>
Code Example |
---|
:: |
:: Collapse all codes in PHP Storm IntelliJ |
:: wordpresss loop through object |
:: |
:: |
Php :: |
:: |
Php :: |
:: New in initializers - PHP 8.1 |
Php :: get current date epoch php |
Php :: |
Php :: wordpress custom end point |
:: vriadic function in php |
:: schema key issue laravel |
:: laravel collection load |
:: |
:: HTTP Authentication example forcing a new name/password |
:: |
Php :: |
:: auto reload page in chat php |
:: |
Php :: |
:: Same Taxonomy Add Multiple Post Type |
Php :: build_Assoc |
:: Deutsch korrektur |
:: Drupal sync directory in settings.php |
:: Jolt transform specification input |
Php :: Determine the percentage of the file uploaded to the server using php |
:: how to make login and logout to blog with php without database or MySQL |
Php :: multipart json test laravel |