@@ -10,81 +10,81 @@ |
||
| 10 | 10 | |
| 11 | 11 | class MaterialDashboardPro |
| 12 | 12 | { |
| 13 | - private Request $request; |
|
| 14 | - private array $menu = []; |
|
| 15 | - private string $pageTitle = 'Page'; |
|
| 16 | - private $user = null; |
|
| 17 | - |
|
| 18 | - private string $backgroundUrl = 'https://picsum.photos/2880/1920?blur=2'; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @param Request $request |
|
| 22 | - */ |
|
| 23 | - public function __construct(Request $request) |
|
| 24 | - { |
|
| 25 | - $this->request = $request; |
|
| 26 | - $this->setMenu(); |
|
| 27 | - $this->setUser($this->request->user()); |
|
| 28 | - $this->setBackgroundUrl(); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - public function getRandomBackgroundUrl(): string |
|
| 32 | - { |
|
| 33 | - return $this->backgroundUrl; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @return void |
|
| 38 | - */ |
|
| 39 | - private function setMenu(): void |
|
| 40 | - { |
|
| 41 | - /** @var MenuBuilder $menuBuilder */ |
|
| 42 | - $menuBuilder = resolve(MenuBuilder::class); |
|
| 43 | - $this->menu = $menuBuilder->build(); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @param Model|null $user |
|
| 48 | - * @return $this |
|
| 49 | - */ |
|
| 50 | - private function setUser(?Model $user): static |
|
| 51 | - { |
|
| 52 | - $this->user = $user; |
|
| 53 | - |
|
| 54 | - return $this; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - public function setBackgroundUrl(): static |
|
| 58 | - { |
|
| 59 | - $this->backgroundUrl = config('mdp.core.static.login_image', $this->backgroundUrl); |
|
| 60 | - |
|
| 61 | - return $this; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - public function hasUser(string $guard = null) |
|
| 65 | - { |
|
| 66 | - return $this->request->user($guard) ?? false; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - public function getUser() |
|
| 70 | - { |
|
| 71 | - return $this->user; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - public function getPageTitle(): string |
|
| 75 | - { |
|
| 76 | - return $this->pageTitle; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - public function setPageTitle(string $pageTitle): static |
|
| 80 | - { |
|
| 81 | - $this->pageTitle = $pageTitle; |
|
| 82 | - |
|
| 83 | - return $this; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function getMenu(): array |
|
| 87 | - { |
|
| 88 | - return $this->menu; |
|
| 89 | - } |
|
| 13 | + private Request $request; |
|
| 14 | + private array $menu = []; |
|
| 15 | + private string $pageTitle = 'Page'; |
|
| 16 | + private $user = null; |
|
| 17 | + |
|
| 18 | + private string $backgroundUrl = 'https://picsum.photos/2880/1920?blur=2'; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @param Request $request |
|
| 22 | + */ |
|
| 23 | + public function __construct(Request $request) |
|
| 24 | + { |
|
| 25 | + $this->request = $request; |
|
| 26 | + $this->setMenu(); |
|
| 27 | + $this->setUser($this->request->user()); |
|
| 28 | + $this->setBackgroundUrl(); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + public function getRandomBackgroundUrl(): string |
|
| 32 | + { |
|
| 33 | + return $this->backgroundUrl; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @return void |
|
| 38 | + */ |
|
| 39 | + private function setMenu(): void |
|
| 40 | + { |
|
| 41 | + /** @var MenuBuilder $menuBuilder */ |
|
| 42 | + $menuBuilder = resolve(MenuBuilder::class); |
|
| 43 | + $this->menu = $menuBuilder->build(); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @param Model|null $user |
|
| 48 | + * @return $this |
|
| 49 | + */ |
|
| 50 | + private function setUser(?Model $user): static |
|
| 51 | + { |
|
| 52 | + $this->user = $user; |
|
| 53 | + |
|
| 54 | + return $this; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + public function setBackgroundUrl(): static |
|
| 58 | + { |
|
| 59 | + $this->backgroundUrl = config('mdp.core.static.login_image', $this->backgroundUrl); |
|
| 60 | + |
|
| 61 | + return $this; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + public function hasUser(string $guard = null) |
|
| 65 | + { |
|
| 66 | + return $this->request->user($guard) ?? false; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + public function getUser() |
|
| 70 | + { |
|
| 71 | + return $this->user; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + public function getPageTitle(): string |
|
| 75 | + { |
|
| 76 | + return $this->pageTitle; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + public function setPageTitle(string $pageTitle): static |
|
| 80 | + { |
|
| 81 | + $this->pageTitle = $pageTitle; |
|
| 82 | + |
|
| 83 | + return $this; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function getMenu(): array |
|
| 87 | + { |
|
| 88 | + return $this->menu; |
|
| 89 | + } |
|
| 90 | 90 | } |