laravel eloquent soft delete

Solutions on MaxInterview for laravel eloquent soft delete by the best coders in the world

showing results for - "laravel eloquent soft delete"
Isabel
23 Jan 2018
1/** in migrations this changes need to
2    add for table we want to add soft delete (LARAVEL)*/
3
4	/** The migrations. START */
5	public function up()
6	{
7		Schema::table('users', function(Blueprint $table)
8		{
9			$table->softDeletes();
10		});
11	}
12	/** The migrations. END */
13
14	/** after adding softdelete you need to
15    point that column in table related model (LARAVEL)*/
16
17	/** The Model. START */
18  	use Illuminate\Database\Eloquent\SoftDeletes;
19  	class User extends Model {
20	  use SoftDeletes;
21	  protected $dates = ['deleted_at'];
22	}
23	/** The Model. END */
Paola
01 Oct 2017
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Model;
6use Illuminate\Database\Eloquent\SoftDeletes;
7
8class Flight extends Model
9{
10    use SoftDeletes;
11}