Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b525a36

Browse filesBrowse files
committed
Mark a model class as booting as soon as the boot process starts
- A model class is removed from the `booting` array as soon as the boot process has completed.
1 parent edcfa60 commit b525a36
Copy full SHA for b525a36

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed

‎src/Illuminate/Database/Eloquent/Model.php

Copy file name to clipboardExpand all lines: src/Illuminate/Database/Eloquent/Model.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToSt
157157
*/
158158
protected static $bootedCallbacks = [];
159159

160+
/**
161+
* Models currently being booted.
162+
*/
163+
protected static array $booting = [];
164+
160165
/**
161166
* The array of trait initializers that will be called on each new instance.
162167
*
@@ -287,12 +292,15 @@ protected function bootIfNotBooted()
287292
{
288293
if (! isset(static::$booted[static::class])) {
289294

295+
static::$booting[static::class] = true;
296+
290297
$this->fireModelEvent('booting', false);
291298

292299
static::booting();
293300
static::boot();
294301

295302
static::$booted[static::class] = true;
303+
unset(static::$booting[static::class]);
296304

297305
static::booted();
298306

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.