tastyigniter / TastyIgniter

:fire: Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
https://tastyigniter.com
MIT License
3.04k stars 994 forks source link

"Trying to get property 'user_id' of non-object" #342

Closed binc0 closed 4 years ago

binc0 commented 4 years ago

Expected behavior: Log in page

Actual behavior: Error page:

{ $query->with(['staff', 'staff.role', 'staff.groups', 'staff.locations']); }

//
//
//

public function getId()
{
    return $this->user()->user_id;
}

public function getUserName()
{
    return $this->user()->username;
}

public function getStaffId()
{
    return $this->staff()->staff_id;
}

public function getStaffName()
{
    return $this->staff()->staff_name;
}

public function getStaffEmail()
{
    return $this->staff()->staff_email;

Arguments "Trying to get property 'user_id' of non-object"

Reproduce steps: I added a new user and to test it I logged out and now if I open admin panel I get this error "Trying to get property 'user_id' of non-object"

Same issue in two fresh installs

Version: beta-20

binc0 commented 4 years ago

Duplicate of #341

sampoyigi commented 4 years ago

It would help to see the full error to determine what triggered the error.

binc0 commented 4 years ago

ErrorException thrown with message "Trying to get property 'user_id' of non-object"

Stacktrace:

79 ErrorException in /app/admin/classes/User.php:58

78 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /app/admin/classes/User.php:58

77 Admin\Classes\User:getId in /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:239

76 Illuminate\Support\Facades\Facade:__callStatic in /extensions/igniter/broadcast/classes/Manager.php:85

75 Igniter\Broadcast\Classes\Manager:addAssetsToController in /extensions/igniter/broadcast/classes/Manager.php:65

74 Igniter\Broadcast\Classes\Manager:Igniter\Broadcast\Classes{closure} in /vendor/tastyigniter/flame/src/Traits/EventEmitter.php:150

73 call_user_func_array in /vendor/tastyigniter/flame/src/Traits/EventEmitter.php:150

72 System\Classes\BaseController:fireEvent in /app/admin/classes/AdminController.php:99

71 Admin\Classes\AdminController:__construct in [internal]:0

70 ReflectionClass:newInstanceArgs in /vendor/laravel/framework/src/Illuminate/Container/Container.php:825

69 Illuminate\Container\Container:build in /vendor/laravel/framework/src/Illuminate/Container/Container.php:667

68 Illuminate\Container\Container:resolve in /vendor/laravel/framework/src/Illuminate/Container/Container.php:615

67 Illuminate\Container\Container:make in /vendor/laravel/framework/src/Illuminate/Foundation/Application.php:767

66 Illuminate\Foundation\Application:make in /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:239

65 Illuminate\Support\Facades\Facade:__callStatic in /app/system/classes/Controller.php:168

64 System\Classes\Controller:locateController in /app/system/classes/Controller.php:203

63 System\Classes\Controller:locateControllerInApp in /app/system/classes/Controller.php:104

62 System\Classes\Controller:runAdmin in /vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54

61 call_user_func_array in /vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54

60 Illuminate\Routing\Controller:callAction in /vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45

59 Illuminate\Routing\ControllerDispatcher:dispatch in /vendor/laravel/framework/src/Illuminate/Routing/Route.php:219

58 Illuminate\Routing\Route:runController in /vendor/laravel/framework/src/Illuminate/Routing/Route.php:176

57 Illuminate\Routing\Route:run in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:680

56 Illuminate\Routing\Router:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30

55 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/tastyigniter/flame/src/Currency/Middleware/CurrencyMiddleware.php:33

54 Igniter\Flame\Currency\Middleware\CurrencyMiddleware:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

53 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

52 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /app/admin/middleware/LogUserLastSeen.php:26

51 Admin\Middleware\LogUserLastSeen:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

50 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

49 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/tastyigniter/flame/src/Translation/Middleware/Localization.php:23

48 Igniter\Flame\Translation\Middleware\Localization:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

47 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

46 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41

45 Illuminate\Routing\Middleware\SubstituteBindings:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

43 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49

42 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

40 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:56

39 Illuminate\Session\Middleware\StartSession:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

37 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37

36 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

34 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66

33 Illuminate\Cookie\Middleware\EncryptCookies:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

31 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104

30 Illuminate\Pipeline\Pipeline:then in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:682

29 Illuminate\Routing\Router:runRouteWithinStack in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:657

28 Illuminate\Routing\Router:runRoute in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:623

27 Illuminate\Routing\Router:dispatchToRoute in /vendor/october/rain/src/Router/CoreRouter.php:20

26 October\Rain\Router\CoreRouter:dispatch in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176

25 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30

24 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /extensions/igniter/debugbar/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php:65

23 Barryvdh\Debugbar\Middleware\InjectDebugbar:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

22 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

21 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /extensions/igniter/cart/middleware/CartMiddleware.php:10

20 Igniter\Cart\Middleware\CartMiddleware:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

19 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

18 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/tastyigniter/flame/src/Setting/Middleware/SaveSetting.php:25

17 Igniter\Flame\Setting\Middleware\SaveSetting:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

15 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/fideloper/proxy/src/TrustProxies.php:57

14 Fideloper\Proxy\TrustProxies:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

12 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21

11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

9 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27

8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

6 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62

5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:163

4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53

3 Illuminate\Routing\Pipeline:Illuminate\Routing{closure} in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104

2 Illuminate\Pipeline\Pipeline:then in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151

1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116

0 Illuminate\Foundation\Http\Kernel:handle in /index.php:53

sampoyigi commented 4 years ago

Very helpful thanks.

sampoyigi commented 4 years ago

Tagged v1.0.3 on Broadcast Extension