Search
 
SCRIPT & CODE EXAMPLE
 

PHP

multiple checked delete in laravel8

//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>
Comment

PREVIOUS NEXT
Code Example
Php :: function id codeigniter 3 
Php :: Collapse all codes in PHP Storm IntelliJ 
Php :: symfony clear session 
Php :: radio checked according to previous data in latravel 
Php :: current tab active on page reload in php 
Php :: Access directory above php 
Php :: PHP quoted_printable_encode — Convert a 8 bit string to a quoted-printable string 
Php :: php mysql submit form 
Php :: var_dump-type and value of expresion 
Php :: bin2hex (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: detect change in log file in real time php 
Php :: list.blade.php 
Php :: length shorter 
Php :: Multiple trait declaration in PHP 
Php :: run specific seeder laravel 
Php :: wordpress add sitemap.xml to robots.txt dynamically 
Php :: lengthawarepaginator gives keys on page 2 
Php :: How to download file with laravel 
Php :: php get long word in array 
Php :: phpImage 
Php :: default time zone for europe php 
Php :: Only Show Specific Countries In Caldera Forms Phone Field 
Php :: How to create custom php.ini file in CPanel? 
Php :: twig global 
Php :: Store Notice 
Php :: findmany laravel 
Php :: How to clear previously echoed items in PHP 
Php :: remove public from laravel url live 
Php :: BelongsToMany relations pivot fields are null in Livewire refresh 
Php :: auto complete order paid2 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =