@@ -22,11 +22,11 @@ |
||
| 22 | 22 | return redirect()->guest('login'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if (! $request->user()->hasRole($role)) { |
|
| 25 | + if (!$request->user()->hasRole($role)) { |
|
| 26 | 26 | abort(403); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if (!empty($permission) and ! $request->user()->can($permission)) { |
|
| 29 | + if (!empty($permission) and !$request->user()->can($permission)) { |
|
| 30 | 30 | abort(403); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | //@TODO implement google or s3 cloud storage support |
| 16 | 16 | //if (config('filesystems.default') == 'google') { |
| 17 | - // $this->media_path = Storage::disk()->getDriver()->getAdapter()->getStorageApiUri() . '/' . Storage::disk()->getDriver()->getAdapter()->getBucket()->name(); |
|
| 17 | + // $this->media_path = Storage::disk()->getDriver()->getAdapter()->getStorageApiUri() . '/' . Storage::disk()->getDriver()->getAdapter()->getBucket()->name(); |
|
| 18 | 18 | //} else { |
| 19 | 19 | //$this->media_path = Storage::disk()->getDriver()->getAdapter()->getPathPrefix(); |
| 20 | 20 | //} |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | { |
| 52 | 52 | $format = $this->chooseFormat($format); |
| 53 | 53 | |
| 54 | - return '<img src="'.$this->getCachedImageUrl($format, $image->name).'" alt="'.$image->description.'" '.$attributes. '>'; |
|
| 54 | + return '<img src="'.$this->getCachedImageUrl($format, $image->name).'" alt="'.$image->description.'" '.$attributes.'>'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | protected function chooseFormat($format) |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function attachments() |
| 22 | 22 | { |
| 23 | - return $this->morphToMany( Attachment::class, 'attachable' )->orderBy('is_main', 'desc'); |
|
| 23 | + return $this->morphToMany(Attachment::class, 'attachable')->orderBy('is_main', 'desc'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function getAttachment() { |
@@ -8,48 +8,48 @@ |
||
| 8 | 8 | |
| 9 | 9 | trait UserConfirmation |
| 10 | 10 | { |
| 11 | - protected $confirmation_field = 'confirmed'; |
|
| 12 | - protected $confirmation_token_field = 'confirmation_code'; |
|
| 11 | + protected $confirmation_field = 'confirmed'; |
|
| 12 | + protected $confirmation_token_field = 'confirmation_code'; |
|
| 13 | 13 | |
| 14 | - public function confirm($code) |
|
| 15 | - { |
|
| 14 | + public function confirm($code) |
|
| 15 | + { |
|
| 16 | 16 | if ($this->{$this->confirmation_token_field} == $code && $this->isPendingConfirmation()) { |
| 17 | - $this->{$this->confirmation_token_field} = null; |
|
| 18 | - $this->{$this->confirmation_field} = 1; |
|
| 19 | - $this->save(); |
|
| 20 | - return true; |
|
| 17 | + $this->{$this->confirmation_token_field} = null; |
|
| 18 | + $this->{$this->confirmation_field} = 1; |
|
| 19 | + $this->save(); |
|
| 20 | + return true; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return false; |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function isConfirmed() |
|
| 27 | - { |
|
| 26 | + public function isConfirmed() |
|
| 27 | + { |
|
| 28 | 28 | return (bool) $this->{$this->confirmation_field}; |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function hasConfirmationCode() |
|
| 32 | - { |
|
| 31 | + public function hasConfirmationCode() |
|
| 32 | + { |
|
| 33 | 33 | return ! is_null($this->{$this->confirmation_token_field} ); |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function isPendingConfirmation() |
|
| 37 | - { |
|
| 36 | + public function isPendingConfirmation() |
|
| 37 | + { |
|
| 38 | 38 | return ! $this->isConfirmed() && $this->hasConfirmationCode(); |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function getConfirmationField() |
|
| 42 | - { |
|
| 41 | + public function getConfirmationField() |
|
| 42 | + { |
|
| 43 | 43 | return $this->confirmation_field; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function getConfirmationTokenField() |
|
| 47 | - { |
|
| 46 | + public function getConfirmationTokenField() |
|
| 47 | + { |
|
| 48 | 48 | return $this->confirmation_token_field; |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function generateConfirmationCode() |
|
| 52 | - { |
|
| 53 | - return hash_hmac('sha256', str_random(40), config('app.key')); |
|
| 54 | - } |
|
| 51 | + public function generateConfirmationCode() |
|
| 52 | + { |
|
| 53 | + return hash_hmac('sha256', str_random(40), config('app.key')); |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -30,12 +30,12 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function hasConfirmationCode() |
| 32 | 32 | { |
| 33 | - return ! is_null($this->{$this->confirmation_token_field} ); |
|
| 33 | + return !is_null($this->{$this->confirmation_token_field} ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function isPendingConfirmation() |
| 37 | 37 | { |
| 38 | - return ! $this->isConfirmed() && $this->hasConfirmationCode(); |
|
| 38 | + return !$this->isConfirmed() && $this->hasConfirmationCode(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function getConfirmationField() |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function attachments() |
| 21 | 21 | { |
| 22 | - return $this->morphToMany( Attachment::class, 'attachable' )->orderBy('is_main', 'desc'); |
|
| 22 | + return $this->morphToMany(Attachment::class, 'attachable')->orderBy('is_main', 'desc'); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | return 'Afrittella\BackProject\Models\Attachment'; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - public function update(array $data, $id, $attribute="id") |
|
| 13 | + public function update(array $data, $id, $attribute = "id") |
|
| 14 | 14 | { |
| 15 | 15 | $model_data = $this->model->where($attribute, '=', $id)->first(); |
| 16 | 16 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -Route::group(['namespace' => '\Afrittella\BackProject\Http\Controllers'], function () { |
|
| 3 | - Route::group(['middleware' => 'web'], function () { |
|
| 2 | +Route::group(['namespace' => '\Afrittella\BackProject\Http\Controllers'], function() { |
|
| 3 | + Route::group(['middleware' => 'web'], function() { |
|
| 4 | 4 | Route::get('confirm/{code}/{user}', 'Auth\RegisterController@confirm')->name('users.confirm'); |
| 5 | 5 | Route::auth(); |
| 6 | 6 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | Route::get('auth/{provider}/callback', 'Auth\SocialLoginController@handleProviderCallback')->name('social_callback'); |
| 9 | 9 | }); |
| 10 | 10 | |
| 11 | - Route::group(['middleware' => 'web', 'prefix' => config('back-project.route_prefix')], function () { |
|
| 11 | + Route::group(['middleware' => 'web', 'prefix' => config('back-project.route_prefix')], function() { |
|
| 12 | 12 | Route::get('dashboard', 'AdminController@dashboard')->name('admin.dashboard'); |
| 13 | 13 | Route::get('account', 'UsersController@account')->name('admin.account'); |
| 14 | 14 | Route::put('account', 'UsersController@accountStore')->name('admin.add-account'); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | Route::get('attachments/{attachment}/main', 'AttachmentsController@setMain')->name('attachments.main'); |
| 19 | 19 | Route::resource('attachments', 'AttachmentsController', ['except' => ['destroy', 'show']]); |
| 20 | 20 | // Users |
| 21 | - Route::group(['middleware' => 'role:administrator'], function () { |
|
| 21 | + Route::group(['middleware' => 'role:administrator'], function() { |
|
| 22 | 22 | Route::get('users/{user}/delete', 'UsersController@delete')->name('users.delete'); // Implementing delete avoiding DELETE method |
| 23 | 23 | Route::resource('users', 'UsersController', ['except' => ['destroy', 'show']]); |
| 24 | 24 | |
@@ -1,23 +1,23 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | - 'route_prefix' => 'admin', |
|
| 4 | - 'registration_open' => true, |
|
| 5 | - 'redirect_after_social_login' => 'admin.dashboard', // where to redirect after successfull login |
|
| 6 | - 'social_login_enabled' => [ |
|
| 7 | - 'facebook' => false, // enable facebook login |
|
| 8 | - 'twitter' => false, // enable twitter login |
|
| 9 | - 'linkedin' => false // enable linkedin login |
|
| 10 | - ], |
|
| 11 | - 'use_queue' => false, |
|
| 12 | - 'user_model' => Afrittella\BackProject\Models\Auth\User::class, |
|
| 13 | - // Menu logos |
|
| 14 | - 'logo_large' => '<b>Back</b>project', |
|
| 15 | - 'logo_small' => '<b>B</b>p', |
|
| 16 | - 'menus' => [ |
|
| 3 | + 'route_prefix' => 'admin', |
|
| 4 | + 'registration_open' => true, |
|
| 5 | + 'redirect_after_social_login' => 'admin.dashboard', // where to redirect after successfull login |
|
| 6 | + 'social_login_enabled' => [ |
|
| 7 | + 'facebook' => false, // enable facebook login |
|
| 8 | + 'twitter' => false, // enable twitter login |
|
| 9 | + 'linkedin' => false // enable linkedin login |
|
| 10 | + ], |
|
| 11 | + 'use_queue' => false, |
|
| 12 | + 'user_model' => Afrittella\BackProject\Models\Auth\User::class, |
|
| 13 | + // Menu logos |
|
| 14 | + 'logo_large' => '<b>Back</b>project', |
|
| 15 | + 'logo_small' => '<b>B</b>p', |
|
| 16 | + 'menus' => [ |
|
| 17 | 17 | 'table' => 'menus' |
| 18 | - ], |
|
| 19 | - 'attachments' => [ |
|
| 20 | - 'table' => 'attachments', |
|
| 21 | - 'max_file_size' => '2' // in Mb |
|
| 22 | - ] |
|
| 18 | + ], |
|
| 19 | + 'attachments' => [ |
|
| 20 | + 'table' => 'attachments', |
|
| 21 | + 'max_file_size' => '2' // in Mb |
|
| 22 | + ] |
|
| 23 | 23 | ]; |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | return [ |
| 3 | - 'Dashboard' => 'Bacheca', |
|
| 4 | - 'Authorization' => 'Autorizzazioni', |
|
| 5 | - 'Users' => 'Utenti', |
|
| 6 | - 'Roles' => 'Ruoli', |
|
| 7 | - 'Permissions' => 'Permessi', |
|
| 8 | - 'Menus' => 'Menu', |
|
| 9 | - 'My Media' => 'Le mie immagini', |
|
| 10 | - 'All Media' => 'Tutte le immagini' |
|
| 3 | + 'Dashboard' => 'Bacheca', |
|
| 4 | + 'Authorization' => 'Autorizzazioni', |
|
| 5 | + 'Users' => 'Utenti', |
|
| 6 | + 'Roles' => 'Ruoli', |
|
| 7 | + 'Permissions' => 'Permessi', |
|
| 8 | + 'Menus' => 'Menu', |
|
| 9 | + 'My Media' => 'Le mie immagini', |
|
| 10 | + 'All Media' => 'Tutte le immagini' |
|
| 11 | 11 | ]; |