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
Php :: screen size to php 
Php :: pagination using ajax 
Php :: php = 
Php :: php two array difference merge recursive 
Php :: png to pdf 
Php :: numbers not displaying in laravel pagination 
Php :: hint extension in visual studio code for laravel 
Php :: php fetch return false 
Php :: Laravel catch TokenMismatchException 
Php :: phpmailer send email to multiple addresses 
Php :: wordpress wp_nav_menu custom id 
Php :: php console print 
Php :: Laravel all() and get() 
Php :: SIMPLE linked list in php 
Php :: PHPDoc @method 
Php :: create middleware laravel 
Php :: php DateTime only date 
Php :: single row data from table in laravel 
Php :: laravel run command 
Php :: laravel showing index of problem 
Php :: Laravel render stuff in a given environment 
Php :: laravel 8 logout 419 page expired 
Php :: share to facebook from website laravel 
Php :: cURL error 6: Could not resolve host: api.themoviedb.org (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.themoviedb.org/3/movie/popular?api_key=5cb73b68870b70a436b10ea06298de07 
Php :: iterator 
Php :: PHP Custom Time Ago Function 
Php :: Use the DebugBar like an array where keys are the collector names 
Php :: json data wdit in php 
Php :: laravel This package is not auto-updated. Please set up the GitHub Hook for Packagist so that it gets updated whenever you push! 
Php :: disable cors laravel 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =