@@ -6,48 +6,48 @@ |
||
6 | 6 | |
7 | 7 | class SetEnvCommand extends Command |
8 | 8 | { |
9 | - /** |
|
10 | - * The name and signature of the console command. |
|
11 | - * |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
9 | + /** |
|
10 | + * The name and signature of the console command. |
|
11 | + * |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + protected $signature = 'epesi:env {name : Env variable(s) to set} {value? : Env variable value}'; |
|
15 | 15 | |
16 | - /** |
|
17 | - * The console command description. |
|
18 | - * |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - protected $description = 'Update ENV variable'; |
|
16 | + /** |
|
17 | + * The console command description. |
|
18 | + * |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + protected $description = 'Update ENV variable'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Execute the console command. |
|
25 | - */ |
|
26 | - public function handle() |
|
27 | - { |
|
28 | - $this->setEnv($this->argument('name'), $this->argument('value')); |
|
29 | - } |
|
23 | + /** |
|
24 | + * Execute the console command. |
|
25 | + */ |
|
26 | + public function handle() |
|
27 | + { |
|
28 | + $this->setEnv($this->argument('name'), $this->argument('value')); |
|
29 | + } |
|
30 | 30 | |
31 | - private static function setEnv($name, $value = null) |
|
32 | - { |
|
33 | - $env = $name; |
|
34 | - if (is_string($name) && !isset($value)) { |
|
35 | - $env = [ |
|
36 | - $name => $value |
|
37 | - ]; |
|
38 | - } |
|
31 | + private static function setEnv($name, $value = null) |
|
32 | + { |
|
33 | + $env = $name; |
|
34 | + if (is_string($name) && !isset($value)) { |
|
35 | + $env = [ |
|
36 | + $name => $value |
|
37 | + ]; |
|
38 | + } |
|
39 | 39 | |
40 | - foreach ($env as $key => $value) { |
|
41 | - $oldSetting = $key . '=' . env($key); |
|
42 | - $newSetting = $key . '=' . $value; |
|
40 | + foreach ($env as $key => $value) { |
|
41 | + $oldSetting = $key . '=' . env($key); |
|
42 | + $newSetting = $key . '=' . $value; |
|
43 | 43 | |
44 | - putenv($newSetting); |
|
44 | + putenv($newSetting); |
|
45 | 45 | |
46 | - file_put_contents(app()->environmentFilePath(), str_replace( |
|
47 | - $oldSetting, |
|
48 | - $newSetting, |
|
49 | - file_get_contents(app()->environmentFilePath()) |
|
50 | - )); |
|
51 | - } |
|
52 | - } |
|
46 | + file_put_contents(app()->environmentFilePath(), str_replace( |
|
47 | + $oldSetting, |
|
48 | + $newSetting, |
|
49 | + file_get_contents(app()->environmentFilePath()) |
|
50 | + )); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class LayoutView extends ModuleView |
33 | 33 | { |
34 | - public $menuLeft; // vertical menu |
|
35 | - public $menu; // horizontal menu |
|
36 | - public $menuRight; // vertical pull-down |
|
34 | + public $menuLeft; // vertical menu |
|
35 | + public $menu; // horizontal menu |
|
36 | + public $menuRight; // vertical pull-down |
|
37 | 37 | public $actionBar; |
38 | 38 | public $locationBar; |
39 | 39 | |
40 | - public $burger = true; // burger menu item |
|
40 | + public $burger = true; // burger menu item |
|
41 | 41 | |
42 | 42 | /* |
43 | 43 | * Whether or not left Menu is visible on Page load. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
89 | 89 | |
90 | 90 | // location bar |
91 | - $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
91 | + $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | public function setLocation($crumbs) |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | |
131 | 131 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
132 | 132 | |
133 | - if (! $this->burger) return; |
|
133 | + if (!$this->burger) return; |
|
134 | 134 | |
135 | - if (! session()->get('menu', 1)) { |
|
135 | + if (!session()->get('menu', 1)) { |
|
136 | 136 | $this->isMenuLeftVisible = false; |
137 | 137 | } |
138 | 138 | |
139 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
139 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
140 | 140 | (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
141 | 141 | (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
142 | 142 | (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
143 | 143 | $this->burger->add('jsCallback')->set(function($j, $visible) { |
144 | - session()->put('menu', $visible? 1: 0); |
|
144 | + session()->put('menu', $visible ? 1 : 0); |
|
145 | 145 | session()->save(); |
146 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
146 | + }, [new \atk4\ui\jsExpression('$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0')]) |
|
147 | 147 | ]); |
148 | 148 | } |
149 | 149 |
@@ -30,36 +30,36 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class LayoutView extends ModuleView |
32 | 32 | { |
33 | - public $menuLeft; // vertical menu |
|
34 | - public $menu; // horizontal menu |
|
35 | - public $menuRight; // vertical pull-down |
|
36 | - public $actionBar; |
|
37 | - public $locationBar; |
|
33 | + public $menuLeft; // vertical menu |
|
34 | + public $menu; // horizontal menu |
|
35 | + public $menuRight; // vertical pull-down |
|
36 | + public $actionBar; |
|
37 | + public $locationBar; |
|
38 | 38 | |
39 | - public $burger = true; // burger menu item |
|
39 | + public $burger = true; // burger menu item |
|
40 | 40 | |
41 | - /* |
|
41 | + /* |
|
42 | 42 | * Whether or not left Menu is visible on Page load. |
43 | 43 | */ |
44 | - public $isMenuLeftVisible = true; |
|
44 | + public $isMenuLeftVisible = true; |
|
45 | 45 | |
46 | - public $defaultTemplate = 'layout/admin.html'; |
|
46 | + public $defaultTemplate = 'layout/admin.html'; |
|
47 | 47 | |
48 | - protected $location; |
|
48 | + protected $location; |
|
49 | 49 | |
50 | - public function init() |
|
51 | - { |
|
52 | - parent::init(); |
|
50 | + public function init() |
|
51 | + { |
|
52 | + parent::init(); |
|
53 | 53 | |
54 | - $this->setMenu(); |
|
55 | - $this->setActionBar(); |
|
54 | + $this->setMenu(); |
|
55 | + $this->setActionBar(); |
|
56 | 56 | |
57 | 57 | // if (request()->pjax()) return; |
58 | 58 | |
59 | - $this->setMenuLeft(); |
|
60 | - $this->setMenuRight(); |
|
59 | + $this->setMenuLeft(); |
|
60 | + $this->setMenuRight(); |
|
61 | 61 | |
62 | - $this->setVersion(); |
|
62 | + $this->setVersion(); |
|
63 | 63 | |
64 | 64 | // $this->js(true, null, 'body')->niceScroll(); |
65 | 65 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | // if (event.originalEvent.persisted) { |
69 | 69 | // window.location.reload(); |
70 | 70 | // }')])); |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - public function setMenu() |
|
74 | - { |
|
75 | - if ($this->menu) return; |
|
73 | + public function setMenu() |
|
74 | + { |
|
75 | + if ($this->menu) return; |
|
76 | 76 | |
77 | - $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
77 | + $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
|
78 | 78 | |
79 | - // company logo |
|
80 | - // see Epesi\Core\Controllers\SystemController::logo |
|
81 | - $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
79 | + // company logo |
|
80 | + // see Epesi\Core\Controllers\SystemController::logo |
|
81 | + $this->menu->add(['class' => ['epesi-logo'], 'style' => ['width' => '167px']])->add(['Image', url('logo')])->setStyle(['max-height' => '32px']); |
|
82 | 82 | |
83 | - if ($this->burger) { |
|
84 | - /** @scrutinizer ignore-call */ |
|
85 | - $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | - } |
|
83 | + if ($this->burger) { |
|
84 | + /** @scrutinizer ignore-call */ |
|
85 | + $this->burger = $this->menu->addItem(['class' => ['icon atk-leftMenuTrigger']]); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | // home icon redirects to /home path |
89 | 89 | // see Epesi\Core\Controllers\SystemController::home |
90 | - $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
90 | + $this->menu->addItem(['class' => ['icon epesi-home']], url('home'))->add(['Icon', 'home']); |
|
91 | 91 | |
92 | 92 | // location bar |
93 | 93 | $this->locationBar = $this->menu->add(['View', ['ui' => 'epesi-location']]); |
@@ -130,50 +130,50 @@ discard block |
||
130 | 130 | ]), 'RightMenu')->addClass('right menu')->removeClass('item'); |
131 | 131 | } |
132 | 132 | |
133 | - public function setMenuLeft() |
|
134 | - { |
|
135 | - if ($this->menuLeft) return; |
|
133 | + public function setMenuLeft() |
|
134 | + { |
|
135 | + if ($this->menuLeft) return; |
|
136 | 136 | |
137 | - $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
137 | + $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
|
138 | 138 | |
139 | - if (! $this->burger) return; |
|
139 | + if (! $this->burger) return; |
|
140 | 140 | |
141 | - if (! session()->get('menu', 1)) { |
|
142 | - $this->isMenuLeftVisible = false; |
|
143 | - } |
|
141 | + if (! session()->get('menu', 1)) { |
|
142 | + $this->isMenuLeftVisible = false; |
|
143 | + } |
|
144 | 144 | |
145 | - $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | - (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | - (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | - (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | - $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | - session()->put('menu', $visible? 1: 0); |
|
151 | - session()->save(); |
|
152 | - }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | - ]); |
|
154 | - } |
|
145 | + $this->burger->add(['Icon', 'content'])->on('click', [ |
|
146 | + (new jQuery('.ui.left.sidebar'))->toggleClass('visible'), |
|
147 | + (new jQuery('.epesi-logo'))->toggleClass('expanded'), |
|
148 | + (new jQuery('body'))->toggleClass('atk-leftMenu-visible'), |
|
149 | + $this->burger->add('jsCallback')->set(function($j, $visible) { |
|
150 | + session()->put('menu', $visible? 1: 0); |
|
151 | + session()->save(); |
|
152 | + }, [new \atk4\ui\jsExpression( '$("#' . $this->menuLeft->id . '").hasClass("visible")? 1: 0' )]) |
|
153 | + ]); |
|
154 | + } |
|
155 | 155 | |
156 | - public function setActionBar() |
|
157 | - { |
|
158 | - if ($this->actionBar) return; |
|
156 | + public function setActionBar() |
|
157 | + { |
|
158 | + if ($this->actionBar) return; |
|
159 | 159 | |
160 | - $this->actionBar = $this->add(Seeds\ActionBar::class, 'ActionBar'); |
|
161 | - } |
|
160 | + $this->actionBar = $this->add(Seeds\ActionBar::class, 'ActionBar'); |
|
161 | + } |
|
162 | 162 | |
163 | - public function setVersion() |
|
164 | - { |
|
165 | - $this->template->trySet('version', $this->app->version); |
|
166 | - } |
|
163 | + public function setVersion() |
|
164 | + { |
|
165 | + $this->template->trySet('version', $this->app->version); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * {@inheritdoc} |
|
170 | - */ |
|
168 | + /** |
|
169 | + * {@inheritdoc} |
|
170 | + */ |
|
171 | 171 | |
172 | - public function renderView() |
|
173 | - { |
|
174 | - if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | - $this->menuLeft->addClass('visible'); |
|
176 | - } |
|
177 | - parent::renderView(); |
|
178 | - } |
|
172 | + public function renderView() |
|
173 | + { |
|
174 | + if ($this->menuLeft && $this->isMenuLeftVisible) { |
|
175 | + $this->menuLeft->addClass('visible'); |
|
176 | + } |
|
177 | + parent::renderView(); |
|
178 | + } |
|
179 | 179 | } |
@@ -72,7 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | public function setMenu() |
74 | 74 | { |
75 | - if ($this->menu) return; |
|
75 | + if ($this->menu) { |
|
76 | + return; |
|
77 | + } |
|
76 | 78 | |
77 | 79 | $this->menu = $this->add(['Menu', 'atk-topMenu fixed horizontal', 'element' => 'header'], 'TopMenu'); |
78 | 80 | |
@@ -123,7 +125,9 @@ discard block |
||
123 | 125 | |
124 | 126 | public function setMenuRight() |
125 | 127 | { |
126 | - if ($this->menuRight) return; |
|
128 | + if ($this->menuRight) { |
|
129 | + return; |
|
130 | + } |
|
127 | 131 | |
128 | 132 | $this->menuRight = $this->menu->add(new Seeds\RightMenu([ |
129 | 133 | 'ui' => false |
@@ -132,11 +136,15 @@ discard block |
||
132 | 136 | |
133 | 137 | public function setMenuLeft() |
134 | 138 | { |
135 | - if ($this->menuLeft) return; |
|
139 | + if ($this->menuLeft) { |
|
140 | + return; |
|
141 | + } |
|
136 | 142 | |
137 | 143 | $this->menuLeft = $this->add(new Seeds\NavMenu('left vertical labeled sidebar'), 'LeftMenu'); |
138 | 144 | |
139 | - if (! $this->burger) return; |
|
145 | + if (! $this->burger) { |
|
146 | + return; |
|
147 | + } |
|
140 | 148 | |
141 | 149 | if (! session()->get('menu', 1)) { |
142 | 150 | $this->isMenuLeftVisible = false; |
@@ -155,7 +163,9 @@ discard block |
||
155 | 163 | |
156 | 164 | public function setActionBar() |
157 | 165 | { |
158 | - if ($this->actionBar) return; |
|
166 | + if ($this->actionBar) { |
|
167 | + return; |
|
168 | + } |
|
159 | 169 | |
160 | 170 | $this->actionBar = $this->add(Seeds\ActionBar::class, 'ActionBar'); |
161 | 171 | } |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class NoCacheHeaders |
8 | 8 | { |
9 | - /** |
|
10 | - * Add cache related HTTP headers. |
|
11 | - * |
|
12 | - * @param \Illuminate\Http\Request $request |
|
13 | - * @param \Closure $next |
|
14 | - * @param string|array $options |
|
15 | - * @return \Symfony\Component\HttpFoundation\Response |
|
16 | - * |
|
17 | - * @throws \InvalidArgumentException |
|
18 | - */ |
|
19 | - public function handle($request, Closure $next, $options = []) |
|
20 | - { |
|
21 | - $response = $next($request); |
|
9 | + /** |
|
10 | + * Add cache related HTTP headers. |
|
11 | + * |
|
12 | + * @param \Illuminate\Http\Request $request |
|
13 | + * @param \Closure $next |
|
14 | + * @param string|array $options |
|
15 | + * @return \Symfony\Component\HttpFoundation\Response |
|
16 | + * |
|
17 | + * @throws \InvalidArgumentException |
|
18 | + */ |
|
19 | + public function handle($request, Closure $next, $options = []) |
|
20 | + { |
|
21 | + $response = $next($request); |
|
22 | 22 | |
23 | - $response->headers->addCacheControlDirective('no-cache', true); |
|
24 | - $response->headers->addCacheControlDirective('max-age', 0); |
|
25 | - $response->headers->addCacheControlDirective('must-revalidate', true); |
|
26 | - $response->headers->addCacheControlDirective('no-store', true); |
|
23 | + $response->headers->addCacheControlDirective('no-cache', true); |
|
24 | + $response->headers->addCacheControlDirective('max-age', 0); |
|
25 | + $response->headers->addCacheControlDirective('must-revalidate', true); |
|
26 | + $response->headers->addCacheControlDirective('no-store', true); |
|
27 | 27 | |
28 | - return $response; |
|
29 | - } |
|
28 | + return $response; |
|
29 | + } |
|
30 | 30 | } |
@@ -6,8 +6,8 @@ |
||
6 | 6 | { |
7 | 7 | public $defaultTemplate = 'launch_button.html'; |
8 | 8 | |
9 | - public $ui = 'basic launch pjax button'; |
|
9 | + public $ui = 'basic launch pjax button'; |
|
10 | 10 | |
11 | - public $container = 'View'; |
|
11 | + public $container = 'View'; |
|
12 | 12 | |
13 | 13 | } |
@@ -8,33 +8,33 @@ |
||
8 | 8 | |
9 | 9 | class User extends Authenticatable |
10 | 10 | { |
11 | - use Notifiable; |
|
12 | - use HasRoles; |
|
11 | + use Notifiable; |
|
12 | + use HasRoles; |
|
13 | 13 | |
14 | - /** |
|
15 | - * The attributes that are mass assignable. |
|
16 | - * |
|
17 | - * @var array |
|
18 | - */ |
|
19 | - protected $fillable = [ |
|
20 | - 'name', 'email', 'password', |
|
21 | - ]; |
|
14 | + /** |
|
15 | + * The attributes that are mass assignable. |
|
16 | + * |
|
17 | + * @var array |
|
18 | + */ |
|
19 | + protected $fillable = [ |
|
20 | + 'name', 'email', 'password', |
|
21 | + ]; |
|
22 | 22 | |
23 | - /** |
|
24 | - * The attributes that should be hidden for arrays. |
|
25 | - * |
|
26 | - * @var array |
|
27 | - */ |
|
28 | - protected $hidden = [ |
|
29 | - 'password', 'remember_token', |
|
30 | - ]; |
|
23 | + /** |
|
24 | + * The attributes that should be hidden for arrays. |
|
25 | + * |
|
26 | + * @var array |
|
27 | + */ |
|
28 | + protected $hidden = [ |
|
29 | + 'password', 'remember_token', |
|
30 | + ]; |
|
31 | 31 | |
32 | - /** |
|
33 | - * The attributes that should be cast to native types. |
|
34 | - * |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - protected $casts = [ |
|
38 | - 'email_verified_at' => 'datetime', |
|
39 | - ]; |
|
32 | + /** |
|
33 | + * The attributes that should be cast to native types. |
|
34 | + * |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + protected $casts = [ |
|
38 | + 'email_verified_at' => 'datetime', |
|
39 | + ]; |
|
40 | 40 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class CreatePasswordResetsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('password_resets', function (Blueprint $table) { |
|
17 | - $table->string('email')->index(); |
|
18 | - $table->string('token'); |
|
19 | - $table->timestamp('created_at')->nullable(); |
|
20 | - }); |
|
21 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('password_resets', function (Blueprint $table) { |
|
17 | + $table->string('email')->index(); |
|
18 | + $table->string('token'); |
|
19 | + $table->timestamp('created_at')->nullable(); |
|
20 | + }); |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Reverse the migrations. |
|
25 | - * |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function down() |
|
29 | - { |
|
30 | - Schema::dropIfExists('password_resets'); |
|
31 | - } |
|
23 | + /** |
|
24 | + * Reverse the migrations. |
|
25 | + * |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function down() |
|
29 | + { |
|
30 | + Schema::dropIfExists('password_resets'); |
|
31 | + } |
|
32 | 32 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('password_resets', function (Blueprint $table) { |
|
16 | + Schema::create('password_resets', function(Blueprint $table) { |
|
17 | 17 | $table->string('email')->index(); |
18 | 18 | $table->string('token'); |
19 | 19 | $table->timestamp('created_at')->nullable(); |
@@ -6,31 +6,31 @@ |
||
6 | 6 | |
7 | 7 | class CreateUsersTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('users', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('email')->unique(); |
|
20 | - $table->timestamp('email_verified_at')->nullable(); |
|
21 | - $table->string('password'); |
|
22 | - $table->rememberToken(); |
|
23 | - $table->timestamps(); |
|
24 | - }); |
|
25 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('users', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('email')->unique(); |
|
20 | + $table->timestamp('email_verified_at')->nullable(); |
|
21 | + $table->string('password'); |
|
22 | + $table->rememberToken(); |
|
23 | + $table->timestamps(); |
|
24 | + }); |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Reverse the migrations. |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function down() |
|
33 | - { |
|
34 | - Schema::dropIfExists('users'); |
|
35 | - } |
|
27 | + /** |
|
28 | + * Reverse the migrations. |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function down() |
|
33 | + { |
|
34 | + Schema::dropIfExists('users'); |
|
35 | + } |
|
36 | 36 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('users', function (Blueprint $table) { |
|
16 | + Schema::create('users', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('email')->unique(); |
@@ -6,97 +6,97 @@ |
||
6 | 6 | |
7 | 7 | class CreatePermissionTables extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - $tableNames = config('permission.table_names'); |
|
17 | - $columnNames = config('permission.column_names'); |
|
18 | - |
|
19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
20 | - $table->bigIncrements('id'); |
|
21 | - $table->string('name'); |
|
22 | - $table->string('guard_name'); |
|
23 | - $table->timestamps(); |
|
24 | - }); |
|
25 | - |
|
26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
27 | - $table->bigIncrements('id'); |
|
28 | - $table->string('name'); |
|
29 | - $table->string('guard_name'); |
|
30 | - $table->timestamps(); |
|
31 | - }); |
|
32 | - |
|
33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | - $table->unsignedBigInteger('permission_id'); |
|
35 | - |
|
36 | - $table->string('model_type'); |
|
37 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
38 | - $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index'); |
|
39 | - |
|
40 | - $table->foreign('permission_id') |
|
41 | - ->references('id') |
|
42 | - ->on($tableNames['permissions']) |
|
43 | - ->onDelete('cascade'); |
|
44 | - |
|
45 | - $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
46 | - 'model_has_permissions_permission_model_type_primary'); |
|
47 | - }); |
|
48 | - |
|
49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | - $table->unsignedBigInteger('role_id'); |
|
51 | - |
|
52 | - $table->string('model_type'); |
|
53 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
54 | - $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index'); |
|
55 | - |
|
56 | - $table->foreign('role_id') |
|
57 | - ->references('id') |
|
58 | - ->on($tableNames['roles']) |
|
59 | - ->onDelete('cascade'); |
|
60 | - |
|
61 | - $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
62 | - 'model_has_roles_role_model_type_primary'); |
|
63 | - }); |
|
64 | - |
|
65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
66 | - $table->unsignedBigInteger('permission_id'); |
|
67 | - $table->unsignedBigInteger('role_id'); |
|
68 | - |
|
69 | - $table->foreign('permission_id') |
|
70 | - ->references('id') |
|
71 | - ->on($tableNames['permissions']) |
|
72 | - ->onDelete('cascade'); |
|
73 | - |
|
74 | - $table->foreign('role_id') |
|
75 | - ->references('id') |
|
76 | - ->on($tableNames['roles']) |
|
77 | - ->onDelete('cascade'); |
|
78 | - |
|
79 | - $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary'); |
|
80 | - }); |
|
81 | - |
|
82 | - app('cache') |
|
83 | - ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
84 | - ->forget(config('permission.cache.key')); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Reverse the migrations. |
|
89 | - * |
|
90 | - * @return void |
|
91 | - */ |
|
92 | - public function down() |
|
93 | - { |
|
94 | - $tableNames = config('permission.table_names'); |
|
95 | - |
|
96 | - Schema::drop($tableNames['role_has_permissions']); |
|
97 | - Schema::drop($tableNames['model_has_roles']); |
|
98 | - Schema::drop($tableNames['model_has_permissions']); |
|
99 | - Schema::drop($tableNames['roles']); |
|
100 | - Schema::drop($tableNames['permissions']); |
|
101 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + $tableNames = config('permission.table_names'); |
|
17 | + $columnNames = config('permission.column_names'); |
|
18 | + |
|
19 | + Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
20 | + $table->bigIncrements('id'); |
|
21 | + $table->string('name'); |
|
22 | + $table->string('guard_name'); |
|
23 | + $table->timestamps(); |
|
24 | + }); |
|
25 | + |
|
26 | + Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
27 | + $table->bigIncrements('id'); |
|
28 | + $table->string('name'); |
|
29 | + $table->string('guard_name'); |
|
30 | + $table->timestamps(); |
|
31 | + }); |
|
32 | + |
|
33 | + Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | + $table->unsignedBigInteger('permission_id'); |
|
35 | + |
|
36 | + $table->string('model_type'); |
|
37 | + $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
38 | + $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index'); |
|
39 | + |
|
40 | + $table->foreign('permission_id') |
|
41 | + ->references('id') |
|
42 | + ->on($tableNames['permissions']) |
|
43 | + ->onDelete('cascade'); |
|
44 | + |
|
45 | + $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
46 | + 'model_has_permissions_permission_model_type_primary'); |
|
47 | + }); |
|
48 | + |
|
49 | + Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | + $table->unsignedBigInteger('role_id'); |
|
51 | + |
|
52 | + $table->string('model_type'); |
|
53 | + $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
54 | + $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index'); |
|
55 | + |
|
56 | + $table->foreign('role_id') |
|
57 | + ->references('id') |
|
58 | + ->on($tableNames['roles']) |
|
59 | + ->onDelete('cascade'); |
|
60 | + |
|
61 | + $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
62 | + 'model_has_roles_role_model_type_primary'); |
|
63 | + }); |
|
64 | + |
|
65 | + Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
66 | + $table->unsignedBigInteger('permission_id'); |
|
67 | + $table->unsignedBigInteger('role_id'); |
|
68 | + |
|
69 | + $table->foreign('permission_id') |
|
70 | + ->references('id') |
|
71 | + ->on($tableNames['permissions']) |
|
72 | + ->onDelete('cascade'); |
|
73 | + |
|
74 | + $table->foreign('role_id') |
|
75 | + ->references('id') |
|
76 | + ->on($tableNames['roles']) |
|
77 | + ->onDelete('cascade'); |
|
78 | + |
|
79 | + $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary'); |
|
80 | + }); |
|
81 | + |
|
82 | + app('cache') |
|
83 | + ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
84 | + ->forget(config('permission.cache.key')); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Reverse the migrations. |
|
89 | + * |
|
90 | + * @return void |
|
91 | + */ |
|
92 | + public function down() |
|
93 | + { |
|
94 | + $tableNames = config('permission.table_names'); |
|
95 | + |
|
96 | + Schema::drop($tableNames['role_has_permissions']); |
|
97 | + Schema::drop($tableNames['model_has_roles']); |
|
98 | + Schema::drop($tableNames['model_has_permissions']); |
|
99 | + Schema::drop($tableNames['roles']); |
|
100 | + Schema::drop($tableNames['permissions']); |
|
101 | + } |
|
102 | 102 | } |
@@ -16,21 +16,21 @@ discard block |
||
16 | 16 | $tableNames = config('permission.table_names'); |
17 | 17 | $columnNames = config('permission.column_names'); |
18 | 18 | |
19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
19 | + Schema::create($tableNames['permissions'], function(Blueprint $table) { |
|
20 | 20 | $table->bigIncrements('id'); |
21 | 21 | $table->string('name'); |
22 | 22 | $table->string('guard_name'); |
23 | 23 | $table->timestamps(); |
24 | 24 | }); |
25 | 25 | |
26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
26 | + Schema::create($tableNames['roles'], function(Blueprint $table) { |
|
27 | 27 | $table->bigIncrements('id'); |
28 | 28 | $table->string('name'); |
29 | 29 | $table->string('guard_name'); |
30 | 30 | $table->timestamps(); |
31 | 31 | }); |
32 | 32 | |
33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
33 | + Schema::create($tableNames['model_has_permissions'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
34 | 34 | $table->unsignedBigInteger('permission_id'); |
35 | 35 | |
36 | 36 | $table->string('model_type'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'model_has_permissions_permission_model_type_primary'); |
47 | 47 | }); |
48 | 48 | |
49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
49 | + Schema::create($tableNames['model_has_roles'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
50 | 50 | $table->unsignedBigInteger('role_id'); |
51 | 51 | |
52 | 52 | $table->string('model_type'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'model_has_roles_role_model_type_primary'); |
63 | 63 | }); |
64 | 64 | |
65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
65 | + Schema::create($tableNames['role_has_permissions'], function(Blueprint $table) use ($tableNames) { |
|
66 | 66 | $table->unsignedBigInteger('permission_id'); |
67 | 67 | $table->unsignedBigInteger('role_id'); |
68 | 68 |
@@ -50,7 +50,7 @@ |
||
50 | 50 | public static function boot() |
51 | 51 | { |
52 | 52 | // allow Super Admin full access |
53 | - Gate::after(function ($user, $ability) { |
|
53 | + Gate::after(function($user, $ability) { |
|
54 | 54 | return $user->hasRole('Super Admin'); |
55 | 55 | }); |
56 | 56 | } |