| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | function blameable_user(Model $model) |
||
| 16 | { |
||
| 17 | $guard = app(BlameableService::class)->getConfiguration($model, 'guard'); |
||
| 18 | |||
| 19 | $user = ($guard === null) ? app('auth')->user() : app('auth')->guard($guard)->user(); |
||
| 20 | $userClass = app(BlameableService::class)->getConfiguration($model, 'user'); |
||
| 21 | |||
| 22 | if (($user instanceof Model) && ($user instanceof $userClass)) { |
||
| 23 | return $user->getKey(); |
||
| 24 | } |
||
| 25 | |||
| 26 | return null; |
||
| 27 | } |
||
| 28 | } |
||
| 29 |