Delete Data
Delete Data

Route

<?php
Route::get('delete_student','Delete_Data@delete_student');

Controller

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Models\Student;

class Delete_Data extends Controller {
public function delete_student(){
$student=Student::find(1);
$student->delete();
}
}

Laravel Delete by Query

DB::table('student')->where('id', '=', 3)->delete();


Previous
Next