@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function update($id, Request $request) |
| 31 | 31 | {
|
| 32 | - $this->validate($request, [ 'value' => 'required' ]); |
|
| 32 | + $this->validate($request, ['value' => 'required']); |
|
| 33 | 33 | |
| 34 | 34 | $move = Base::getSettingsRepository()->findOrFail($id); |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $after = $move->value; |
| 41 | 41 | |
| 42 | - Base::Log('Website settings changed. Changed "' . $move->friendly_name . '" value from "' . $before . '" to "' . $after . '"');
|
|
| 42 | + Base::Log('Website settings changed. Changed "'.$move->friendly_name.'" value from "'.$before.'" to "'.$after.'"');
|
|
| 43 | 43 | |
| 44 | 44 | return redirect('admin/settings');
|
| 45 | 45 | } |
@@ -17,8 +17,9 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | - if (config('jlourenco.base.VisitCounter')) |
|
| 21 | - Base::RegisterVisit(); |
|
| 20 | + if (config('jlourenco.base.VisitCounter')) { |
|
| 21 | + Base::RegisterVisit(); |
|
| 22 | + } |
|
| 22 | 23 | |
| 23 | 24 | return $next($request); |
| 24 | 25 | } |
@@ -20,10 +20,11 @@ |
||
| 20 | 20 | { |
| 21 | 21 | if ($user->force_new_password) |
| 22 | 22 | { |
| 23 | - if ($request->ajax()) |
|
| 24 | - return response('New password is required. Login into the website.', 401); |
|
| 25 | - else |
|
| 26 | - return Redirect::route('change-password'); |
|
| 23 | + if ($request->ajax()) { |
|
| 24 | + return response('New password is required. Login into the website.', 401); |
|
| 25 | + } else { |
|
| 26 | + return Redirect::route('change-password'); |
|
| 27 | + } |
|
| 27 | 28 | } |
| 28 | 29 | } |
| 29 | 30 | return $next($request); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if ($value > 0) |
| 39 | 39 | if ($user = Sentinel::findUserById($value)) |
| 40 | 40 | if ($user != null) |
| 41 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
| 41 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
| 42 | 42 | |
| 43 | 43 | return $value; |
| 44 | 44 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | if ($value > 0) |
| 55 | 55 | if ($user = Sentinel::findUserById($value)) |
| 56 | 56 | if ($user != null) |
| 57 | - return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
|
| 57 | + return $user->first_name.' '.$user->last_name.' (ID: '.$user->id.')'; |
|
| 58 | 58 | |
| 59 | 59 | return $value; |
| 60 | 60 | } |
@@ -35,10 +35,11 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function getCreatedByAttribute($value) |
| 37 | 37 | { |
| 38 | - if ($value > 0) |
|
| 39 | - if ($user = Sentinel::findUserById($value)) |
|
| 38 | + if ($value > 0) { |
|
| 39 | + if ($user = Sentinel::findUserById($value)) |
|
| 40 | 40 | if ($user != null) |
| 41 | 41 | return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
| 42 | + } |
|
| 42 | 43 | |
| 43 | 44 | return $value; |
| 44 | 45 | } |
@@ -51,10 +52,11 @@ discard block |
||
| 51 | 52 | */ |
| 52 | 53 | public function getTargetAttribute($value) |
| 53 | 54 | { |
| 54 | - if ($value > 0) |
|
| 55 | - if ($user = Sentinel::findUserById($value)) |
|
| 55 | + if ($value > 0) { |
|
| 56 | + if ($user = Sentinel::findUserById($value)) |
|
| 56 | 57 | if ($user != null) |
| 57 | 58 | return $user->first_name . ' ' . $user->last_name . ' (ID: ' . $user->id . ')'; |
| 59 | + } |
|
| 58 | 60 | |
| 59 | 61 | return $value; |
| 60 | 62 | } |
@@ -28,13 +28,13 @@ |
||
| 28 | 28 | $str = explode("* ", $this->description); |
| 29 | 29 | $choices = array(); |
| 30 | 30 | |
| 31 | - foreach($str as $st) |
|
| 31 | + foreach ($str as $st) |
|
| 32 | 32 | { |
| 33 | 33 | preg_match('/(?P<digit>\d+) - (?P<name>\w+)/', $st, $matches); |
| 34 | 34 | if (sizeof($matches) > 0) { |
| 35 | - $st = str_replace("*/","",$st); |
|
| 36 | - $st = str_replace("/*","",$st); |
|
| 37 | - $choices[$matches[1]] = explode($matches[1] . ' - ', $st)[1]; |
|
| 35 | + $st = str_replace("*/", "", $st); |
|
| 36 | + $st = str_replace("/*", "", $st); |
|
| 37 | + $choices[$matches[1]] = explode($matches[1].' - ', $st)[1]; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function up() |
| 15 | 15 | {
|
| 16 | 16 | |
| 17 | - Schema::create('User', function (Blueprint $table) {
|
|
| 17 | + Schema::create('User', function(Blueprint $table) {
|
|
| 18 | 18 | $table->increments('id');
|
| 19 | 19 | $table->string('username', 25)->nullable()->unique();
|
| 20 | 20 | $table->string('password', 60)->nullable();
|
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | $table->creation(); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - Schema::table('User', function (Blueprint $table) {
|
|
| 40 | + Schema::table('User', function(Blueprint $table) {
|
|
| 41 | 41 | $table->creationRelation(); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - Schema::create('Visits', function (Blueprint $table) {
|
|
| 44 | + Schema::create('Visits', function(Blueprint $table) {
|
|
| 45 | 45 | $table->increments('id');
|
| 46 | 46 | $table->string('url')->nullable();
|
| 47 | 47 | $table->string('ip', 15)->nullable();
|
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $table->timestamps(); |
| 61 | 61 | }); |
| 62 | 62 | |
| 63 | - Schema::create('Logs', function (Blueprint $table) {
|
|
| 63 | + Schema::create('Logs', function(Blueprint $table) {
|
|
| 64 | 64 | $table->increments('id');
|
| 65 | 65 | $table->text('log');
|
| 66 | 66 | $table->integer('target')->nullable();
|
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | $table->creation(); |
| 70 | 70 | }); |
| 71 | 71 | |
| 72 | - Schema::table('Logs', function (Blueprint $table) {
|
|
| 72 | + Schema::table('Logs', function(Blueprint $table) {
|
|
| 73 | 73 | $table->creationRelation(); |
| 74 | 74 | }); |
| 75 | 75 | |
| 76 | - Schema::create('Settings', function (Blueprint $table) {
|
|
| 76 | + Schema::create('Settings', function(Blueprint $table) {
|
|
| 77 | 77 | $table->increments('id');
|
| 78 | 78 | $table->string('friendly_name', 25);
|
| 79 | 79 | $table->string('name', 25);
|
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | $table->creation(); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | - Schema::table('Settings', function (Blueprint $table) {
|
|
| 86 | + Schema::table('Settings', function(Blueprint $table) {
|
|
| 87 | 87 | $table->creationRelation(); |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - Schema::create('Group', function (Blueprint $table) {
|
|
| 90 | + Schema::create('Group', function(Blueprint $table) {
|
|
| 91 | 91 | $table->increments('id');
|
| 92 | 92 | $table->string('name', 25);
|
| 93 | 93 | $table->string('description', 250)->nullable();
|
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | $table->unique('slug');
|
| 102 | 102 | }); |
| 103 | 103 | |
| 104 | - Schema::table('Group', function (Blueprint $table) {
|
|
| 104 | + Schema::table('Group', function(Blueprint $table) {
|
|
| 105 | 105 | $table->creationRelation(); |
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | - Schema::create('Group_User', function (Blueprint $table) {
|
|
| 108 | + Schema::create('Group_User', function(Blueprint $table) {
|
|
| 109 | 109 | $table->increments('id');
|
| 110 | 110 | $table->integer('user')->unsigned();
|
| 111 | 111 | $table->integer('group')->unsigned();
|
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | $table->foreign('group')->references('id')->on('Group');
|
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | - Schema::table('Group_User', function (Blueprint $table) {
|
|
| 121 | + Schema::table('Group_User', function(Blueprint $table) {
|
|
| 122 | 122 | $table->creationRelation(); |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | - Schema::create('ActivityFeed', function (Blueprint $table) {
|
|
| 125 | + Schema::create('ActivityFeed', function(Blueprint $table) {
|
|
| 126 | 126 | $table->increments('id');
|
| 127 | 127 | $table->string('added_by', 150);
|
| 128 | 128 | $table->text('activity');
|
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * All the "restricted area" routes |
| 6 | 6 | * are defined here. |
| 7 | 7 | */ |
| 8 | -Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function ()
|
|
| 8 | +Route::group(array('prefix' => '/', 'middleware' => 'webPublic'), function()
|
|
| 9 | 9 | {
|
| 10 | 10 | |
| 11 | 11 | /** |
@@ -32,23 +32,23 @@ discard block |
||
| 32 | 32 | /* POST */ Route::post('login', 'jlourenco\base\Controllers\AuthController@postSignin');
|
| 33 | 33 | |
| 34 | 34 | /* GET */ Route::get('register', array('as' => 'register', 'uses' => 'jlourenco\base\Controllers\AuthController@getSignup'));
|
| 35 | - /* POST */ Route::post('register', array('as' => 'register','uses' => 'jlourenco\base\Controllers\AuthController@postSignup'));
|
|
| 35 | + /* POST */ Route::post('register', array('as' => 'register', 'uses' => 'jlourenco\base\Controllers\AuthController@postSignup'));
|
|
| 36 | 36 | |
| 37 | 37 | /* GET */ Route::get('forgot-password', array('as' => 'forgot-password', 'uses' => 'jlourenco\base\Controllers\AuthController@getLostPassword'));
|
| 38 | - /* POST */ Route::post('forgot-password', array('as' => 'forgot-password','uses' => 'jlourenco\base\Controllers\AuthController@postForgotPassword'));
|
|
| 38 | + /* POST */ Route::post('forgot-password', array('as' => 'forgot-password', 'uses' => 'jlourenco\base\Controllers\AuthController@postForgotPassword'));
|
|
| 39 | 39 | |
| 40 | 40 | # Forgot Password Confirmation |
| 41 | 41 | Route::get('forgot-password/{userId}/{passwordResetCode}', array('as' => 'forgot-password-confirm', 'uses' => 'jlourenco\base\Controllers\AuthController@getForgotPasswordConfirm'));
|
| 42 | 42 | Route::post('forgot-password/{userId}/{passwordResetCode}', 'jlourenco\base\Controllers\AuthController@postForgotPasswordConfirm');
|
| 43 | 43 | |
| 44 | 44 | # Logout |
| 45 | - Route::get('logout', array('as' => 'logout','uses' => 'jlourenco\base\Controllers\AuthController@getLogout'));
|
|
| 45 | + Route::get('logout', array('as' => 'logout', 'uses' => 'jlourenco\base\Controllers\AuthController@getLogout'));
|
|
| 46 | 46 | |
| 47 | 47 | # Account Activation |
| 48 | 48 | Route::get('activate/{userId}/{activationCode}', array('as' => 'activate', 'uses' => 'jlourenco\base\Controllers\AuthController@getActivate'));
|
| 49 | 49 | |
| 50 | 50 | # User account |
| 51 | - Route::group(array('middleware' => 'SentinelUser'), function () {
|
|
| 51 | + Route::group(array('middleware' => 'SentinelUser'), function() {
|
|
| 52 | 52 | Route::get('my-account', array('as' => 'my-account', 'uses' => 'jlourenco\base\Controllers\UsersController@myAccount'));
|
| 53 | 53 | Route::post('my-account', 'jlourenco\base\Controllers\UsersController@updateAccount');
|
| 54 | 54 | }); |
@@ -47,31 +47,31 @@ discard block |
||
| 47 | 47 | // Publish our views |
| 48 | 48 | $this->loadViewsFrom(base_path("resources/views"), 'base'); |
| 49 | 49 | $this->publishes([ |
| 50 | - __DIR__ . '/views' => base_path("resources/views") |
|
| 50 | + __DIR__.'/views' => base_path("resources/views") |
|
| 51 | 51 | ]); |
| 52 | 52 | |
| 53 | 53 | // Publish our lang |
| 54 | 54 | $this->publishes([ |
| 55 | - __DIR__ . '/lang' => base_path("resources/lang") |
|
| 55 | + __DIR__.'/lang' => base_path("resources/lang") |
|
| 56 | 56 | ], 'migrations'); |
| 57 | 57 | |
| 58 | 58 | // Publish our migrations |
| 59 | 59 | $this->publishes([ |
| 60 | - __DIR__ . '/migrations' => base_path("database/migrations") |
|
| 60 | + __DIR__.'/migrations' => base_path("database/migrations") |
|
| 61 | 61 | ], 'migrations'); |
| 62 | 62 | |
| 63 | 63 | // Publish a config file |
| 64 | 64 | $this->publishes([ |
| 65 | - __DIR__ . '/config' => base_path('/config') |
|
| 65 | + __DIR__.'/config' => base_path('/config') |
|
| 66 | 66 | ], 'config'); |
| 67 | 67 | |
| 68 | 68 | // Publish our routes |
| 69 | 69 | $this->publishes([ |
| 70 | - __DIR__ . '/routes.php' => base_path("app/Http/base_routes.php") |
|
| 70 | + __DIR__.'/routes.php' => base_path("app/Http/base_routes.php") |
|
| 71 | 71 | ], 'routes'); |
| 72 | 72 | |
| 73 | 73 | // Include the routes file |
| 74 | - if(file_exists(base_path("app/Http/base_routes.php"))) |
|
| 74 | + if (file_exists(base_path("app/Http/base_routes.php"))) |
|
| 75 | 75 | include base_path("app/Http/base_routes.php"); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | protected function registerUsers() |
| 84 | 84 | { |
| 85 | - $this->app->singleton('jlourenco.user', function ($app) { |
|
| 85 | + $this->app->singleton('jlourenco.user', function($app) { |
|
| 86 | 86 | $config = $app['config']->get('jlourenco.base'); |
| 87 | 87 | |
| 88 | 88 | $users = array_get($config, 'models.User'); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function registerGroups() |
| 104 | 104 | { |
| 105 | - $this->app->singleton('jlourenco.group', function ($app) { |
|
| 105 | + $this->app->singleton('jlourenco.group', function($app) { |
|
| 106 | 106 | $config = $app['config']->get('jlourenco.base'); |
| 107 | 107 | |
| 108 | 108 | $model = array_get($config, 'base.models.Group'); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function registerSettings() |
| 120 | 120 | { |
| 121 | - $this->app->singleton('jlourenco.settings', function ($app) { |
|
| 121 | + $this->app->singleton('jlourenco.settings', function($app) { |
|
| 122 | 122 | $config = $app['config']->get('jlourenco.base'); |
| 123 | 123 | |
| 124 | 124 | $model = array_get($config, 'models.Settings'); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | protected function registerLog() |
| 136 | 136 | { |
| 137 | - $this->app->singleton('jlourenco.log', function ($app) { |
|
| 137 | + $this->app->singleton('jlourenco.log', function($app) { |
|
| 138 | 138 | $config = $app['config']->get('jlourenco.base'); |
| 139 | 139 | |
| 140 | 140 | $model = array_get($config, 'models.Logs'); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | protected function registerVisits() |
| 152 | 152 | { |
| 153 | - $this->app->singleton('jlourenco.visits', function ($app) { |
|
| 153 | + $this->app->singleton('jlourenco.visits', function($app) { |
|
| 154 | 154 | $config = $app['config']->get('jlourenco.base'); |
| 155 | 155 | |
| 156 | 156 | $model = array_get($config, 'models.Visits'); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | protected function registerJobs() |
| 168 | 168 | { |
| 169 | - $this->app->singleton('jlourenco.jobs', function ($app) { |
|
| 169 | + $this->app->singleton('jlourenco.jobs', function($app) { |
|
| 170 | 170 | $config = $app['config']->get('jlourenco.base'); |
| 171 | 171 | |
| 172 | 172 | $model = array_get($config, 'models.Jobs'); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | protected function registerBase() |
| 184 | 184 | { |
| 185 | - $this->app->singleton('base', function ($app) { |
|
| 185 | + $this->app->singleton('base', function($app) { |
|
| 186 | 186 | $base = new Base($app['jlourenco.settings'], $app['jlourenco.user'], $app['jlourenco.log'], $app['jlourenco.visits'], $app['jlourenco.jobs']); |
| 187 | 187 | |
| 188 | 188 | return $base; |
@@ -71,8 +71,9 @@ discard block |
||
| 71 | 71 | ], 'routes'); |
| 72 | 72 | |
| 73 | 73 | // Include the routes file |
| 74 | - if(file_exists(base_path("app/Http/base_routes.php"))) |
|
| 75 | - include base_path("app/Http/base_routes.php"); |
|
| 74 | + if(file_exists(base_path("app/Http/base_routes.php"))) { |
|
| 75 | + include base_path("app/Http/base_routes.php"); |
|
| 76 | + } |
|
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | /** |
@@ -88,8 +89,9 @@ discard block |
||
| 88 | 89 | $users = array_get($config, 'models.User'); |
| 89 | 90 | $model = array_get($config, 'models.Group'); |
| 90 | 91 | |
| 91 | - if (class_exists($model) && method_exists($model, 'setUsersModel')) |
|
| 92 | - forward_static_call_array([$model, 'setUsersModel'], [$users]); |
|
| 92 | + if (class_exists($model) && method_exists($model, 'setUsersModel')) { |
|
| 93 | + forward_static_call_array([$model, 'setUsersModel'], [$users]); |
|
| 94 | + } |
|
| 93 | 95 | |
| 94 | 96 | return new UserRepository($users); |
| 95 | 97 | }); |