Closed k0hel closed 2 years ago
Try
$form->deleting(function ($form) {
dd(
$form->id
);
})
dd($form->id);
null
dd($form->model());
App\Models\Test {#1580
#connection: "mysql"
#table: "test"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
+preventsLazyLoading: false
#perPage: 15
+exists: false
+wasRecentlyCreated: false
#escapeWhenCastingToString: false
#attributes: []
#original: []
#changes: []
#casts: array:1 [
"deleted_at" => "datetime"
]
#classCastCache: []
#attributeCastCache: []
#dates: []
#dateFormat: null
#appends: []
#dispatchesEvents: []
#observables: []
#relations: []
#touches: []
+timestamps: true
#hidden: []
#visible: []
#fillable: []
#guarded: array:1 [
0 => "*"
]
#forceDeleting: false
}
same
$form->model()->id;
null
I already know that document and code. It works with respect to submitted, saving and saved mentioned. not work for deleting and deleted. deleting and deleted are not documented, so I don't know if it's actually a bug or not. deleted method seems to be called after deleting the model, so I think the absence of the model is the right move. but, deleting method seems to be called before deleting the model, it should be able to refer to the model.
couldn't get the model, but could get the primary key id.
$form->deleting(function ($form,$id) {
Log::debug($id);
});
Description:
I want to get id of the deleting records. but model return null. oddly enough, it works fine at submitted, saving, saved.
Steps To Reproduce: