Answers for "laravel deleted at"

PHP
2

get soft deleted data laravel

To also get soft deleted models : 

$trashedAndNotTrashed = Model::withTrashed()->get();

Only soft deleted models in your results : 

$onlySoftDeleted = Model::onlyTrashed()->get();
Posted by: Guest on November-28-2020
3

laravel soft delete

/** in migrations this changes need to
    add for table we want to add soft delete (LARAVEL)*/

	/** The migrations. START */
	public function up()
	{
		Schema::table('users', function(Blueprint $table)
		{
			$table->softDeletes();
		});
	}
	/** The migrations. END */

	/** after adding softdelete you need to
    point that column in table related model (LARAVEL)*/

	/** The Model. START */
  	use Illuminate\Database\Eloquent\SoftDeletes;
  	class User extends Model {
	  use SoftDeletes;
	  protected $dates = ['deleted_at'];
	}
	/** The Model. END */
Posted by: Guest on November-17-2020
1

laravel delete

DB::table('users')->where('votes', '>', 100)->delete();
Posted by: Guest on March-11-2021
0

Laravel Delete

Flight::destroy(1);

Flight::destroy(1, 2, 3);

Flight::destroy([1, 2, 3]);

Flight::destroy(collect([1, 2, 3]));
Posted by: Guest on April-27-2021
1

larave Soft Deletes

Schema::table('flights', function (Blueprint $table) {
    $table->softDeletes();
});
Posted by: Guest on June-12-2020
0

laravel force delete

Product::onlyTrashed()->where('deleted_at', '<', Carbon::subDays(30))->forceDelete();
Posted by: Guest on December-27-2020

Browse Popular Code Answers by Language