Guest User

Untitled

a guest
Feb 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. <div class="modal fade" id="delete-form" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  2. <div class="modal-dialog" role="document">
  3. <div class="modal-content">
  4. <div class="modal-header">
  5. <h5 class="modal-title" id="exampleModalLabel">Delete Account</h5>
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  7. <span aria-hidden="true">&times;</span>
  8. </button>
  9. </div>
  10. <div class="modal-body">
  11.  
  12. <form id="delete-form" action="{{ route('account.destroy', [$account->id]) }}" method="post">
  13.  
  14. <input type="hidden" name="_method" value="delete">
  15. {{ csrf_field() }}
  16. <p>Are you sure you want to delete this data? </p>
  17.  
  18. </div>
  19. <div class="modal-footer">
  20. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  21. <button type="submit" class="btn btn-primary">Save changes</button>
  22. </div>
  23. </form>
  24. </div>
  25. </div>
  26. </div>
  27.  
  28. public function destroy(Account $account)
  29. {
  30. $findAccount = Account::find($account->id);
  31.  
  32. if($findAccount->delete()){
  33.  
  34. return redirect()->route('account.index')->with('success', 'Account details delete successfully!');
  35. }
  36.  
  37. return back()->withInput()->with('error', 'Account details could not be deleted.');
  38. }
Add Comment
Please, Sign In to add comment