I've got these polymorphic relations:
staff:
id - integer
name - string
orders:
id - integer
price - integer
photos:
id - integer
path - string
imageable_id - integer
imageable_type - string
And in a controller:
public function example() {
\DB::beginTransaction();
try {
$staff = Staff::findOrFail(1);
$row = $staff->photos()->create([ 'path' => 1 ]);
$row->path = 2;
$row->save();
abort(445);
} catch( \Exception $e ) {
\DB::rollback()
}
}
As expected, the current row must be deleted from photos table, but it still there with path = 2
Do I think in a right away? or It's a misundertanding?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire