@@ -47,10 +47,11 @@ |
||
| 47 | 47 | $itemGenerator = new $generator($module); |
| 48 | 48 | $returnedFiles = $itemGenerator->generate(); |
| 49 | 49 | |
| 50 | - if (!is_array($returnedFiles)) |
|
| 51 | - $generatedFiles[] = $returnedFiles; |
|
| 52 | - else |
|
| 53 | - $generatedFiles = array_merge($generatedFiles, $returnedFiles); |
|
| 50 | + if (!is_array($returnedFiles)) { |
|
| 51 | + $generatedFiles[] = $returnedFiles; |
|
| 52 | + } else { |
|
| 53 | + $generatedFiles = array_merge($generatedFiles, $returnedFiles); |
|
| 54 | + } |
|
| 54 | 55 | |
| 55 | 56 | $bar->advance(); |
| 56 | 57 | } |
@@ -1,41 +1,41 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | - 'items_to_generate' => [ |
|
| 4 | - 'Common' => [ |
|
| 5 | - 'Migration', |
|
| 6 | - 'Model', |
|
| 7 | - 'Seeder', |
|
| 8 | - 'Route' |
|
| 9 | - ], |
|
| 10 | - 'Frontend' => [ |
|
| 11 | - 'Controller', |
|
| 12 | - ], |
|
| 13 | - 'Backend' => [ |
|
| 14 | - 'Controller', |
|
| 15 | - 'Api', |
|
| 16 | - 'Request', |
|
| 17 | - 'View', |
|
| 18 | - 'Notification', |
|
| 19 | - 'Observer' |
|
| 20 | - ] |
|
| 21 | - ], |
|
| 22 | - 'files_to_publish' => [ |
|
| 3 | + 'items_to_generate' => [ |
|
| 4 | + 'Common' => [ |
|
| 5 | + 'Migration', |
|
| 6 | + 'Model', |
|
| 7 | + 'Seeder', |
|
| 8 | + 'Route' |
|
| 9 | + ], |
|
| 10 | + 'Frontend' => [ |
|
| 11 | + 'Controller', |
|
| 12 | + ], |
|
| 13 | + 'Backend' => [ |
|
| 14 | + 'Controller', |
|
| 15 | + 'Api', |
|
| 16 | + 'Request', |
|
| 17 | + 'View', |
|
| 18 | + 'Notification', |
|
| 19 | + 'Observer' |
|
| 20 | + ] |
|
| 21 | + ], |
|
| 22 | + 'files_to_publish' => [ |
|
| 23 | 23 | 'public', |
| 24 | 24 | 'app', |
| 25 | 25 | 'database', |
| 26 | 26 | 'resources', |
| 27 | - ], |
|
| 28 | - 'image_sizes' => [ |
|
| 29 | - 'sm' => '500x500', |
|
| 30 | - 'md' => '800x800', |
|
| 31 | - 'xs' => '200x200', |
|
| 32 | - ], |
|
| 33 | - 'events' => [ |
|
| 34 | - 'created','updated','deleted' |
|
| 35 | - ], |
|
| 36 | - 'seed_rows' => 25, |
|
| 37 | - 'listing_per_page' => 20, |
|
| 38 | - 'generic_fields' => true, |
|
| 39 | - 'seo_fields' => true, |
|
| 40 | - 'user_model' => 'App\User' |
|
| 27 | + ], |
|
| 28 | + 'image_sizes' => [ |
|
| 29 | + 'sm' => '500x500', |
|
| 30 | + 'md' => '800x800', |
|
| 31 | + 'xs' => '200x200', |
|
| 32 | + ], |
|
| 33 | + 'events' => [ |
|
| 34 | + 'created','updated','deleted' |
|
| 35 | + ], |
|
| 36 | + 'seed_rows' => 25, |
|
| 37 | + 'listing_per_page' => 20, |
|
| 38 | + 'generic_fields' => true, |
|
| 39 | + 'seo_fields' => true, |
|
| 40 | + 'user_model' => 'App\User' |
|
| 41 | 41 | ]; |
| 42 | 42 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | '--provider' => 'Prateekkarki\Laragen\LaragenServiceProvider' |
| 31 | 31 | ]); |
| 32 | 32 | |
| 33 | - Artisan::call('vendor:publish', [ |
|
| 33 | + Artisan::call('vendor:publish', [ |
|
| 34 | 34 | '--provider' => 'Spatie\Permission\PermissionServiceProvider' |
| 35 | 35 | ]); |
| 36 | 36 | |
@@ -70,10 +70,12 @@ |
||
| 70 | 70 | |
| 71 | 71 | $routeFile = app_path('Providers/LaragenRouteServiceProvider.php'); |
| 72 | 72 | $observerFile = app_path('Providers/LaragenObserverServiceProvider.php'); |
| 73 | - if (file_exists($routeFile)) |
|
| 74 | - $this->app->register("\App\Providers\LaragenRouteServiceProvider"); |
|
| 75 | - if (file_exists($observerFile)) |
|
| 76 | - $this->app->register("\App\Providers\LaragenObserverServiceProvider"); |
|
| 73 | + if (file_exists($routeFile)) { |
|
| 74 | + $this->app->register("\App\Providers\LaragenRouteServiceProvider"); |
|
| 75 | + } |
|
| 76 | + if (file_exists($observerFile)) { |
|
| 77 | + $this->app->register("\App\Providers\LaragenObserverServiceProvider"); |
|
| 78 | + } |
|
| 77 | 79 | } |
| 78 | 80 | /** |
| 79 | 81 | * To register laragen as first level command. E.g. laragen:generate |
@@ -6,17 +6,17 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AlterUsersTable extends Migration |
| 8 | 8 | { |
| 9 | - public function up() |
|
| 10 | - { |
|
| 11 | - Schema::table('users', function (Blueprint $table) { |
|
| 12 | - $table->string('api_token', 60)->unique()->nullable(); |
|
| 13 | - }); |
|
| 14 | - } |
|
| 9 | + public function up() |
|
| 10 | + { |
|
| 11 | + Schema::table('users', function (Blueprint $table) { |
|
| 12 | + $table->string('api_token', 60)->unique()->nullable(); |
|
| 13 | + }); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function down() |
|
| 17 | - { |
|
| 18 | - Schema::table('users', function (Blueprint $table) { |
|
| 19 | - $table->dropColumn(['api_token']); |
|
| 20 | - }); |
|
| 21 | - } |
|
| 16 | + public function down() |
|
| 17 | + { |
|
| 18 | + Schema::table('users', function (Blueprint $table) { |
|
| 19 | + $table->dropColumn(['api_token']); |
|
| 20 | + }); |
|
| 21 | + } |
|
| 22 | 22 | } |
@@ -14,18 +14,18 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function run() |
| 16 | 16 | { |
| 17 | - $email = '[email protected]'; |
|
| 18 | - $pass = Hash::make('password'); |
|
| 17 | + $email = '[email protected]'; |
|
| 18 | + $pass = Hash::make('password'); |
|
| 19 | 19 | |
| 20 | - $user = User::where('email', '=', $email)->first(); |
|
| 21 | - if ($user === null) { |
|
| 22 | - $user = new App\User(); |
|
| 23 | - $user->password = $pass; |
|
| 24 | - $user->email = $email; |
|
| 25 | - $user->email_verified_at = now(); |
|
| 26 | - $user->remember_token = Str::random(10); |
|
| 27 | - $user->name = 'Admin User'; |
|
| 28 | - $user->save(); |
|
| 29 | - } |
|
| 20 | + $user = User::where('email', '=', $email)->first(); |
|
| 21 | + if ($user === null) { |
|
| 22 | + $user = new App\User(); |
|
| 23 | + $user->password = $pass; |
|
| 24 | + $user->email = $email; |
|
| 25 | + $user->email_verified_at = now(); |
|
| 26 | + $user->remember_token = Str::random(10); |
|
| 27 | + $user->name = 'Admin User'; |
|
| 28 | + $user->save(); |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | class User extends Authenticatable |
| 10 | 10 | { |
| 11 | - use HasRoles; |
|
| 11 | + use HasRoles; |
|
| 12 | 12 | use Notifiable; |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -60,11 +60,11 @@ |
||
| 60 | 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, |
| 61 | 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
| 62 | 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
| 63 | - 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, |
|
| 64 | - 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, |
|
| 65 | - 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, |
|
| 66 | - 'jwt.verify' => \App\Http\Middleware\JwtMiddleware::class, |
|
| 67 | - ]; |
|
| 63 | + 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, |
|
| 64 | + 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, |
|
| 65 | + 'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class, |
|
| 66 | + 'jwt.verify' => \App\Http\Middleware\JwtMiddleware::class, |
|
| 67 | + ]; |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * The priority-sorted list of middleware. |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | 15 | $this->middleware(function ($request, $next) { |
| 16 | - if(!auth()->user()->getRoleNames()->contains('super-admin')) |
|
| 17 | - abort(403, 'Access denied'); |
|
| 16 | + if(!auth()->user()->getRoleNames()->contains('super-admin')) { |
|
| 17 | + abort(403, 'Access denied'); |
|
| 18 | + } |
|
| 18 | 19 | return $next($request); |
| 19 | 20 | }); |
| 20 | 21 | |
@@ -44,8 +45,9 @@ discard block |
||
| 44 | 45 | return $perm; |
| 45 | 46 | })->groupBy(function ($perm) { |
| 46 | 47 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
| 47 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
| 48 | - return Str::title(str_replace('_', ' ', $module)); |
|
| 48 | + if(Str::contains($perm->name, str_replace('_', ' ', $module))) { |
|
| 49 | + return Str::title(str_replace('_', ' ', $module)); |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | return "Others"; |
| 51 | 53 | }), |
@@ -63,8 +65,9 @@ discard block |
||
| 63 | 65 | return $perm; |
| 64 | 66 | })->groupBy(function ($perm) { |
| 65 | 67 | foreach (array_keys(app('laragen')->getModules()) as $module) { |
| 66 | - if(Str::contains($perm->name, str_replace('_', ' ', $module))) |
|
| 67 | - return Str::title(str_replace('_', ' ', $module)); |
|
| 68 | + if(Str::contains($perm->name, str_replace('_', ' ', $module))) { |
|
| 69 | + return Str::title(str_replace('_', ' ', $module)); |
|
| 70 | + } |
|
| 68 | 71 | } |
| 69 | 72 | return "Others"; |
| 70 | 73 | }), |
@@ -76,8 +79,9 @@ discard block |
||
| 76 | 79 | */ |
| 77 | 80 | public function store(Request $request) |
| 78 | 81 | { |
| 79 | - if (!$request->name) |
|
| 80 | - return redirect()->back()->withErrors(['name' => 'Name cannot be empty.']); |
|
| 82 | + if (!$request->name) { |
|
| 83 | + return redirect()->back()->withErrors(['name' => 'Name cannot be empty.']); |
|
| 84 | + } |
|
| 81 | 85 | |
| 82 | 86 | $role = Role::create(['name' => $request->name]); |
| 83 | 87 | $role->permissions()->attach($request->permissions); |
@@ -194,8 +194,9 @@ |
||
| 194 | 194 | |
| 195 | 195 | protected function getPath($path) |
| 196 | 196 | {
|
| 197 | - if (!is_dir($path)) |
|
| 198 | - mkdir($path, 0755, true); |
|
| 197 | + if (!is_dir($path)) { |
|
| 198 | + mkdir($path, 0755, true); |
|
| 199 | + } |
|
| 199 | 200 | |
| 200 | 201 | return $path; |
| 201 | 202 | } |