julianstark999/laravel-model-iid
Laravel package that adds a compact, auto-incrementing IID column to Eloquent models, giving records a short human-friendly identifier for URLs, support tickets, and admin views while UUIDs or ULIDs remain the real primary key.
composer require <vendor>/<package>:^0.1.2. Soft deletes are an additive feature; nothing in the release note signals a breaking change from the 0.1.x line.deleted_at column was added. If the table is yours, add $table->softDeletes() yourself — the trait will not create the column for you.use Illuminate\Database\Eloquent\SoftDeletes; inside the class body. If the package ships a base model, verify 0.1.2 already includes it rather than double-applying it.deleted_at as a date automatically; older or heavily customised models may still need protected $dates = ['deleted_at'].$record->delete() → the row stays in the table with a timestamp → Model::withTrashed()->find($id)->restore() brings it back.Look first at the package's model/trait source and its migration stub, then the README section on deleting. Those two files tell you whether the package is managing the soft-delete lifecycle for you or just handing you the trait.
withTrashed() (show everything) or onlyTrashed() (recycle bin / restore UI).->withTrashed() in the route definition or use Route::bind() with an explicit withTrashed() query.restore() with a policy check, and hook the restored event (or an observer) to log who restored what and when.belongsTo pointing at a soft-deletable parent returns null when the parent is trashed. Decide per-relationship whether ->withTrashed() is appropriate — usually yes for historical records, no for live references.deleting model event or a dedicated action/service class so the parent and children are always deleted together.Model::onlyTrashed()->where('deleted_at', '<', now()->subDays(30))->forceDelete() in a queued command, chunked with chunkById() on large tables.deleted_at in your resources, or add a trashed boolean accessor, so clients can distinguish live from deleted records without a second request.assertSoftDeleted(), assertNotSoftDeleted(), and assertRestored() against the database rather than asserting on return values.deleted_at (MySQL needs care here because NULL doesn't collide the way you might expect).forceDelete() bypasses soft deletes entirely. Gate destructive endpoints separately from ordinary delete — they are not the same permission.DB::table() queries and raw SQL will happily return trashed rows; don't mix them into the same reporting path.restore() on a non-trashed model is a silent no-op, not an exception. Call trashed() first if your endpoint needs to report failure.updateOrCreate can resurrect trashed rows if the lookup query is unscoped. Add withTrashed() deliberately or not at all.withTrashed() inside the job.deleting, deleted, restoring, restored, forceDeleted) and observers are the safest way to customise behaviour without forking the package.How can I help you explore Laravel packages today?