| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace LaravelFlare\Flare\Http\Controllers\LTS; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Flare; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Illuminate\Http\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Illuminate\Support\Facades\Auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Illuminate\Contracts\Auth\Guard; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use LaravelFlare\Flare\Admin\AdminManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Illuminate\Foundation\Bus\DispatchesJobs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Illuminate\Foundation\Auth\RegistersUsers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use LaravelFlare\Flare\Permissions\Permissions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Illuminate\Foundation\Auth\ThrottlesLogins; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Illuminate\Foundation\Auth\ResetsPasswords; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Illuminate\Foundation\Auth\AuthenticatesUsers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use LaravelFlare\Flare\Http\Controllers\FlareController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use LaravelFlare\Flare\Admin\Widgets\WidgetAdminManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class AdminController extends FlareController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     use AuthenticatesUsers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     use ThrottlesLogins; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     use ResetsPasswords; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     use RegistersUsers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     use DispatchesJobs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * Auth. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @var Guard | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     protected $auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * __construct. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * @param Guard        $auth | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * @param AdminManager $adminManager | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public function __construct(Guard $auth, AdminManager $adminManager) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         parent::__construct($adminManager); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         $this->auth = $auth; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * Show the Dashboard. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @return \Illuminate\Http\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     public function getDashboard() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         $view = 'admin.dashboard'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         if (!view()->exists($view)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             $view = 'flare::'.$view; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         return view($view, ['widgets' => (new WidgetAdminManager())]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * Show the login form. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * @return \Illuminate\Http\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     public function getLogin() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         return view('flare::admin.login'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * Log the user. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * @return \Illuminate\Http\RedirectReponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     public function getLogout() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         $this->auth->logout(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         return redirect('/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * Display the form to request a password reset link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * @return \Illuminate\Http\Response | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 90 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |     public function getEmail() | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |         return view('flare::admin.password'); | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * Display the form to request a password reset link. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * @return \Illuminate\Http\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     public function getReset() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         return view('flare::admin.reset'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      * Performs the login redirect action. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * If the authenticated user has admin permissions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |      * then they will be redirected into the admin | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * panel. If they do no, they will be sent | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * to the homepage of the website. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      * @return \Illuminate\Http\RedirectReponse | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     public function redirectPath() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         if (Permissions::check()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |             return redirect()->intended(Flare::adminUrl()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         return redirect('/'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * Get the path to the login route. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     public function loginPath() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |         return Flare::adminUrl('login'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * Method is called when the appropriate controller | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * method is unable to be found or called. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @param array $parameters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |      * @return \Illuminate\Http\Response | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     public function missingMethod($parameters = array()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         return Response::view('flare::admin.404', [], 404); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 147 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 148 |  |  |  | 
            
                        
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: