Search
 
SCRIPT & CODE EXAMPLE
 

PHP

delete method laravel

//go to 18 min mark in link

//html:

<div class="btnContainer">
<form method="POST" action='/user/{{ $user->id }}'>
    @csrf
    @method('DELETE')
        <button type="submit" class="submitbtn" name="deleteUser">Delete user</button>
</form>
</div>

//Route: 

Route::delete('/user/{user}', function($id){
    $user = User::findOrFail($id);
    $user->delete();
    return redirect('/users');
});
Comment

laravel delete method

public function destroy(Post $post)
    {
        Gate::authorize('delete',$post);

        Storage::delete("public/cover/".$post->cover);
        $post->delete();

        return redirect()->route('index')->with('status','Post Deleted');
    }
Comment

PREVIOUS NEXT
Code Example
:: onclick on image php 
::  
Php ::  
::  
Php :: init curl 
Php :: ignore user id on email validation laravel 
Php :: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in 
Php :: post rest drupal 
Php :: mac os down upgrade php version 
Php ::  
Php :: laravel make:action 
Php :: avatar generator laravel 
Php :: Laravel 7 pagination with search filter 
Php :: serve https with php local 
Php :: php 8 Match Expression / Switch Case 
Php :: enable phpmailer cpanel 
Php ::  
Php :: php email sender 
Php :: php session 
Php :: attach one or multiple files laravel mail 
:: php form validation 
:: php //input 
Php ::  
Php :: merge strings in php 
Php :: laravel debugbar ServiceProvider to the providers 
Php :: upload image to mysqli database 
Php :: wherenotnull laravel 
Php :: export laravel path fedora 
Php :: Wampserver does not use, modify or require the PATH environment variable. 
Php :: radio button in php form 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =