How to use Delete Statement in Laravel 5

We can delete the record using the DB facade with execute a delete statement (delete the record from the database). Like update, the number of rows affected by the statement will be returned.

Let’s create a delete Statement in laravel 5

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use DB;

class PostController extends Controller
{
    public function DeleteData()
    {
         DB::delete('delete from post');    
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *