Support the ongoing development of Laravel.io →
Laravel Forms Views

Hi all..l have a list of users been feed from a database and view and delete can be performed any of the users. l defined a route on the anchor tag of the delete word

<a href="/users_delete/{{ $users->id }}">delete</a>

in the route file l have

Route::get('/user_delete/{id}','AdminUserManagement@delete_user')->name('user_delete');

this is the function in the AdminUserManagement controller

 public function delete_user($id){

    	//select the user by id
    	$user = User::find($id);

        if($user->user_type ==  0){
 
          return  "Admin can not be deleted";

        }else{

          //delete the user if he is customer|merchant
          $user = $user->delete();

        if($user){

            return redirect('users')->with('status','User Deleted successfully');
        }
            
        }

This works fine but when l try to integrate a bootstrap modal that says something like are you sure you want to delete.. it gets a little confusing. please help.. this is the modal l created

<div class="modal fade col-md-6 offset-md-3" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Are you sure you want to delete luxury lawyer’s account</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
       account icluding all your publicatons and statistics will be gone. they cannot be retrived. please 
click the cancel button to discard
      </div>
      <div class="modal-footer">
        <button type="button" class="btn closeDia" data-dismiss="modal">Cancel</button>
        <button type="button" data-toggle="modal" data-target="#deletedModal" data-dismiss="modal" class="btn actionDia">Delete</button>
      </div>
    </div>
  </div>
</div>
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Austin austin77 Joined 26 Mar 2018

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.