@@ -8,7 +8,6 @@ |
||
8 | 8 | use Afrittella\BackProject\Models\Observers\SaveFileWhenAddingAttachment; |
9 | 9 | use Illuminate\Support\ServiceProvider; |
10 | 10 | use Illuminate\Routing\Router; |
11 | -use Route; |
|
12 | 11 | use function Symfony\Component\HttpKernel\Tests\controller_func; |
13 | 12 | |
14 | 13 | class BackProjectServiceProvider extends ServiceProvider |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | // - first the published views (in case they have any changes) |
35 | 35 | $this->loadViewsFrom(resource_path('views/vendor/back-project/base'), 'back-project'); |
36 | 36 | // - then the stock views that come with the package, in case a published view might be missing |
37 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'back-project'); |
|
37 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'back-project'); |
|
38 | 38 | // Load Translations |
39 | - $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'back-project'); |
|
39 | + $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'back-project'); |
|
40 | 40 | |
41 | 41 | // use the vendor configuration file as fallback |
42 | 42 | $this->mergeConfigFrom( |
43 | - __DIR__ . '/../config/config.php', 'back-project' |
|
43 | + __DIR__.'/../config/config.php', 'back-project' |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | $this->routes($router); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | return new BackProject($app); |
65 | 65 | });*/ |
66 | 66 | |
67 | - $this->app->singleton('attachments-manager', function ($app) { |
|
67 | + $this->app->singleton('attachments-manager', function($app) { |
|
68 | 68 | return new MediaManager(); |
69 | 69 | }); |
70 | 70 | |
71 | - $this->app->singleton('back-project', function ($app) { |
|
71 | + $this->app->singleton('back-project', function($app) { |
|
72 | 72 | return new BackProject(); |
73 | 73 | }); |
74 | 74 | |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | public function publishFiles() |
106 | 106 | { |
107 | 107 | // publish config file |
108 | - $this->publishes([__DIR__ . '/../config/config.php' => config_path() . '/back-project.php'], 'config'); |
|
108 | + $this->publishes([__DIR__.'/../config/config.php' => config_path().'/back-project.php'], 'config'); |
|
109 | 109 | // publish lang files |
110 | - $this->publishes([__DIR__ . '/../resources/lang' => resource_path('lang/vendor/back-project')], 'lang'); |
|
110 | + $this->publishes([__DIR__.'/../resources/lang' => resource_path('lang/vendor/back-project')], 'lang'); |
|
111 | 111 | // publish public Backpack assets |
112 | - $this->publishes([__DIR__ . '/../public' => public_path('vendor/back-project')], 'public'); |
|
112 | + $this->publishes([__DIR__.'/../public' => public_path('vendor/back-project')], 'public'); |
|
113 | 113 | // publish views |
114 | - $this->publishes([__DIR__ . '/../resources/views' => resource_path('views/vendor/back-project')], 'views'); |
|
114 | + $this->publishes([__DIR__.'/../resources/views' => resource_path('views/vendor/back-project')], 'views'); |
|
115 | 115 | // publish error views |
116 | - $this->publishes([__DIR__ . '/../resources/error_views' => resource_path('views/errors')], 'errors'); |
|
116 | + $this->publishes([__DIR__.'/../resources/error_views' => resource_path('views/errors')], 'errors'); |
|
117 | 117 | // publish public AdminLTE assets |
118 | 118 | $this->publishes(['vendor/almasaeed2010/adminlte/bootstrap' => public_path('vendor/adminlte/bootstrap')], 'adminlte'); |
119 | 119 | $this->publishes(['vendor/almasaeed2010/adminlte/dist' => public_path('vendor/adminlte/dist')], 'adminlte'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | //$router->aliasMiddleware('guest', \Afrittella\BackProject\Http\Middleware\RedirectIfAuthenticated::class); |
129 | 129 | $router->aliasMiddleware('role', \Afrittella\BackProject\Http\Middleware\Role::class); |
130 | 130 | |
131 | - $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
|
131 | + $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function handleMigrations() |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $timestamp = date('Y_m_d_His', time()); |
139 | 139 | |
140 | 140 | $this->publishes([ |
141 | - __DIR__ . '/../database/migrations/' . $file . '.php' => |
|
142 | - database_path('migrations/' . $timestamp . '_' . $file . '.php') |
|
141 | + __DIR__.'/../database/migrations/'.$file.'.php' => |
|
142 | + database_path('migrations/'.$timestamp.'_'.$file.'.php') |
|
143 | 143 | ], 'migrations'); |
144 | 144 | } |
145 | 145 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | public function loadHelpers() |
180 | 180 | { |
181 | 181 | foreach ($this->helpers as $helper): |
182 | - $file = __DIR__ . '/Helpers/' . $helper . '.php'; |
|
182 | + $file = __DIR__.'/Helpers/'.$helper.'.php'; |
|
183 | 183 | |
184 | 184 | if (file_exists($file)) { |
185 | 185 | require_once($file); |
@@ -3,7 +3,6 @@ |
||
3 | 3 | use Afrittella\BackProject\Models\Menu; |
4 | 4 | use Afrittella\BackProject\Models\Role; |
5 | 5 | use Afrittella\BackProject\Models\Permission; |
6 | - |
|
7 | 6 | use Illuminate\Console\Command; |
8 | 7 | use Illuminate\Support\Facades\DB; |
9 | 8 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function handle() |
28 | 28 | { |
29 | 29 | |
30 | - $nodes = [ |
|
30 | + $nodes = [ |
|
31 | 31 | 'name' => 'admin-menu', |
32 | 32 | 'title' => 'Administrator Menu', |
33 | 33 | 'description' => 'A default menu you can use for back office purposes', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'is_active' => 1, |
37 | 37 | 'is_protected' => 1, |
38 | 38 | 'children' => [ |
39 | - [ |
|
39 | + [ |
|
40 | 40 | 'name' => 'dashboard', |
41 | 41 | 'permission' => 'backend', |
42 | 42 | 'title' => 'Dashboard', |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | 'icon' => 'fa fa-dashboard', |
46 | 46 | 'is_active' => 1, |
47 | 47 | 'is_protected' => 1, |
48 | - ], |
|
49 | - [ |
|
48 | + ], |
|
49 | + [ |
|
50 | 50 | 'name' => 'auth', |
51 | 51 | 'title' => 'Authorization', |
52 | 52 | 'description' => 'Manage Users, Roles and Permissions', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'icon' => 'fa fa-key', |
55 | 55 | 'is_active' => 1, |
56 | 56 | 'children' => [ |
57 | - [ |
|
57 | + [ |
|
58 | 58 | 'name' => 'users', |
59 | 59 | 'permission' => 'administration', |
60 | 60 | 'title' => 'Users', |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | 'route' => config('back-project.route_prefix').'/users', |
63 | 63 | 'icon' => 'fa fa-users', |
64 | 64 | 'is_active' => 1 |
65 | - ], |
|
66 | - [ |
|
65 | + ], |
|
66 | + [ |
|
67 | 67 | 'name' => 'roles', |
68 | 68 | 'permission' => 'administration', |
69 | 69 | 'title' => 'Roles', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | 'route' => config('back-project.route_prefix').'/roles', |
72 | 72 | 'icon' => 'fa fa-group', |
73 | 73 | 'is_active' => 1 |
74 | - ], |
|
75 | - [ |
|
74 | + ], |
|
75 | + [ |
|
76 | 76 | 'name' => 'permissions', |
77 | 77 | 'permission' => 'administration', |
78 | 78 | 'title' => 'Permissions', |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | 'route' => config('back-project.route_prefix').'/permissions', |
81 | 81 | 'icon' => 'fa fa-group', |
82 | 82 | 'is_active' => 1 |
83 | - ] |
|
83 | + ] |
|
84 | 84 | ] |
85 | - ], |
|
86 | - [ |
|
85 | + ], |
|
86 | + [ |
|
87 | 87 | 'name' => 'menus', |
88 | 88 | 'permission' => 'administration', |
89 | 89 | 'title' => 'Menus', |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | 'icon' => 'fa fa-ellipsis-v', |
93 | 93 | 'is_active' => 1, |
94 | 94 | 'is_protected' => 1, |
95 | - ], |
|
96 | - [ |
|
95 | + ], |
|
96 | + [ |
|
97 | 97 | 'name' => 'attachments', |
98 | 98 | 'permission' => 'backend', |
99 | 99 | 'title' => 'My Media', |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | 'icon' => 'fa fa-user-circle-o', |
103 | 103 | 'is_active' => 1, |
104 | 104 | 'is_protected' => 1, |
105 | - ], |
|
106 | - [ |
|
105 | + ], |
|
106 | + [ |
|
107 | 107 | 'name' => 'admin-attachments', |
108 | 108 | 'permission' => 'administration', |
109 | 109 | 'title' => 'All Media', |
@@ -112,36 +112,36 @@ discard block |
||
112 | 112 | 'icon' => 'fa fa-file-image-o', |
113 | 113 | 'is_active' => 1, |
114 | 114 | 'is_protected' => 1, |
115 | - ], |
|
115 | + ], |
|
116 | 116 | ] |
117 | - ]; |
|
117 | + ]; |
|
118 | 118 | |
119 | - // Truncate menu table |
|
120 | - DB::table('menus')->truncate(); |
|
119 | + // Truncate menu table |
|
120 | + DB::table('menus')->truncate(); |
|
121 | 121 | |
122 | - Menu::create($nodes); |
|
122 | + Menu::create($nodes); |
|
123 | 123 | |
124 | - $menus = DB::table('menus')->select('permission')->where('permission', '<>', '')->groupBy('permission')->get(); |
|
124 | + $menus = DB::table('menus')->select('permission')->where('permission', '<>', '')->groupBy('permission')->get(); |
|
125 | 125 | |
126 | - $role = Role::where('name', '=', 'administrator')->first(); |
|
127 | - $user_role = Role::where('name', '=', 'user')->first(); |
|
126 | + $role = Role::where('name', '=', 'administrator')->first(); |
|
127 | + $user_role = Role::where('name', '=', 'user')->first(); |
|
128 | 128 | |
129 | - foreach ($menus as $menu): |
|
129 | + foreach ($menus as $menu): |
|
130 | 130 | |
131 | 131 | if (!empty($menu->permission)) { |
132 | - $permission = Permission::firstOrCreate(['name' => $menu->permission]); |
|
132 | + $permission = Permission::firstOrCreate(['name' => $menu->permission]); |
|
133 | 133 | |
134 | - if (!$role->hasPermissionTo($menu->permission)) { |
|
134 | + if (!$role->hasPermissionTo($menu->permission)) { |
|
135 | 135 | |
136 | - $role->givePermissionTo($menu->permission); |
|
137 | - } |
|
136 | + $role->givePermissionTo($menu->permission); |
|
137 | + } |
|
138 | 138 | |
139 | - if ($menu->permission == 'backend' and !$role->hasPermissionTo($menu->permission)) { |
|
140 | - $user_role->givePermissionTo($menu->permission); |
|
141 | - } |
|
142 | - } |
|
143 | - endforeach; |
|
139 | + if ($menu->permission == 'backend' and !$role->hasPermissionTo($menu->permission)) { |
|
140 | + $user_role->givePermissionTo($menu->permission); |
|
141 | + } |
|
142 | + } |
|
143 | + endforeach; |
|
144 | 144 | |
145 | - $this->info('Seeding admin-menu'.'...'); |
|
145 | + $this->info('Seeding admin-menu'.'...'); |
|
146 | 146 | } |
147 | 147 | } |
@@ -2,8 +2,6 @@ |
||
2 | 2 | namespace Afrittella\BackProject\Console\Commands; |
3 | 3 | |
4 | 4 | use Illuminate\Console\Command; |
5 | -use Illuminate\Support\Facades\DB; |
|
6 | - |
|
7 | 5 | use Afrittella\BackProject\Models\Role; |
8 | 6 | |
9 | 7 | class SeedPermissions extends Command |
@@ -5,10 +5,8 @@ |
||
5 | 5 | use Illuminate\Broadcasting\Channel; |
6 | 6 | use Illuminate\Queue\SerializesModels; |
7 | 7 | use Illuminate\Broadcasting\PrivateChannel; |
8 | -use Illuminate\Broadcasting\PresenceChannel; |
|
9 | 8 | use Illuminate\Foundation\Events\Dispatchable; |
10 | 9 | use Illuminate\Broadcasting\InteractsWithSockets; |
11 | -use Illuminate\Contracts\Broadcasting\ShouldBroadcast; |
|
12 | 10 | |
13 | 11 | class UserRegistered |
14 | 12 | { |
@@ -2,14 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Afrittella\BackProject\Http\Controllers; |
4 | 4 | |
5 | -use Afrittella\BackProject\Exceptions\NotFoundException; |
|
6 | -use Afrittella\BackProject\Facades\MediaManager; |
|
7 | 5 | use Afrittella\BackProject\Http\Requests\AttachmentAdd; |
8 | 6 | use Afrittella\BackProject\Repositories\Attachments; |
9 | 7 | use Afrittella\BackProject\Repositories\Criteria\Attachments\ByUser; |
10 | 8 | use Illuminate\Http\Request; |
11 | 9 | use Illuminate\Support\Facades\Auth; |
12 | -use Illuminate\Support\Facades\Storage; |
|
13 | 10 | use Prologue\Alerts\Facades\Alert; |
14 | 11 | |
15 | 12 | class AttachmentsController extends Controller |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Afrittella\BackProject\Http\Controllers\Auth; |
3 | 3 | |
4 | 4 | use Afrittella\BackProject\Http\Controllers\Controller; |
5 | - |
|
6 | 5 | use Illuminate\Foundation\Auth\SendsPasswordResetEmails; |
7 | 6 | |
8 | 7 | class ForgotPasswordController extends Controller |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * |
51 | 51 | * @param \Illuminate\Http\Request $request |
52 | 52 | * |
53 | - * @return \Illuminate\Http\Response |
|
53 | + * @return \Illuminate\Http\RedirectResponse |
|
54 | 54 | */ |
55 | 55 | public function register(Request $request, Users $users) |
56 | 56 | { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | protected $data = []; // the information we send to the view |
17 | 17 | |
18 | - use RegistersUsers; |
|
18 | + use RegistersUsers; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Create a new controller instance. |
@@ -77,24 +77,24 @@ discard block |
||
77 | 77 | |
78 | 78 | public function validator(array $data) |
79 | 79 | { |
80 | - $user_model = config('back-project.user_model'); |
|
81 | - $user = new $user_model; |
|
82 | - $users_table = $user->getTable(); |
|
80 | + $user_model = config('back-project.user_model'); |
|
81 | + $user = new $user_model; |
|
82 | + $users_table = $user->getTable(); |
|
83 | 83 | |
84 | - return Validator::make($data, [ |
|
84 | + return Validator::make($data, [ |
|
85 | 85 | 'username' => 'required|max:255|unique:'.$users_table, |
86 | 86 | 'email' => 'required|email|max:255|unique:'.$users_table, |
87 | 87 | 'password' => 'required|min:6|confirmed' |
88 | - ]); |
|
88 | + ]); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function confirm(Users $users, $code, $username) { |
92 | - if ($users->findBy('username', $username)->confirm($code)) { |
|
93 | - Alert::add('success', trans('back-project::base.user_confirmed'))->flash(); |
|
94 | - } else { |
|
95 | - Alert::add('error', trans('back-project::base.user_not_confirmed'))->flash(); |
|
96 | - } |
|
92 | + if ($users->findBy('username', $username)->confirm($code)) { |
|
93 | + Alert::add('success', trans('back-project::base.user_confirmed'))->flash(); |
|
94 | + } else { |
|
95 | + Alert::add('error', trans('back-project::base.user_not_confirmed'))->flash(); |
|
96 | + } |
|
97 | 97 | |
98 | - return redirect(route('login')); |
|
98 | + return redirect(route('login')); |
|
99 | 99 | } |
100 | 100 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | /** |
17 | 17 | * Custom authorization method. Use only if you are managing a model with "user_id" field |
18 | 18 | * |
19 | - * @param $ability |
|
19 | + * @param string $ability |
|
20 | 20 | * @param array $record |
21 | 21 | */ |
22 | 22 | public function bCAuthorize($ability, $record = []) |
@@ -2,13 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace Afrittella\BackProject\Http\Controllers; |
4 | 4 | |
5 | -use Afrittella\BackProject\Facades\MediaManager; |
|
6 | 5 | use Afrittella\BackProject\Repositories\Attachments; |
7 | 6 | use Afrittella\BackProject\Repositories\Criteria\Attachments\All; |
8 | -use Afrittella\BackProject\Repositories\Criteria\Attachments\ByUser; |
|
9 | 7 | use Illuminate\Http\Request; |
10 | 8 | use Illuminate\Support\Facades\Auth; |
11 | -use Illuminate\Support\Facades\Storage; |
|
12 | 9 | use Prologue\Alerts\Facades\Alert; |
13 | 10 | |
14 | 11 | class MediaController extends Controller |