@@ -5,32 +5,32 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateCmsPrivilegesTable extends Migration { |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('cms_privileges', function(Blueprint $table) |
|
| 16 | - { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->string('name', 50)->nullable(); |
|
| 19 | - $table->boolean('is_superadmin')->nullable(); |
|
| 20 | - $table->string('theme_color', 50)->nullable(); |
|
| 21 | - $table->timestamps(); |
|
| 22 | - }); |
|
| 23 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('cms_privileges', function(Blueprint $table) |
|
| 16 | + { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->string('name', 50)->nullable(); |
|
| 19 | + $table->boolean('is_superadmin')->nullable(); |
|
| 20 | + $table->string('theme_color', 50)->nullable(); |
|
| 21 | + $table->timestamps(); |
|
| 22 | + }); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Reverse the migrations. |
|
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function down() |
|
| 32 | - { |
|
| 33 | - Schema::drop('cms_privileges'); |
|
| 34 | - } |
|
| 26 | + /** |
|
| 27 | + * Reverse the migrations. |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function down() |
|
| 32 | + { |
|
| 33 | + Schema::drop('cms_privileges'); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | } |
@@ -5,36 +5,36 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateCmsSettingsTable extends Migration { |
| 7 | 7 | |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('cms_settings', function(Blueprint $table) |
|
| 16 | - { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->string('name', 50)->nullable(); |
|
| 19 | - $table->text('content', 65535)->nullable(); |
|
| 20 | - $table->string('content_input_type')->nullable(); |
|
| 21 | - $table->string('dataenum')->nullable(); |
|
| 22 | - $table->string('helper')->nullable(); |
|
| 23 | - $table->timestamps(); |
|
| 24 | - $table->string('group_setting', 50)->nullable(); |
|
| 25 | - $table->string('label', 50)->nullable(); |
|
| 26 | - }); |
|
| 27 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('cms_settings', function(Blueprint $table) |
|
| 16 | + { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->string('name', 50)->nullable(); |
|
| 19 | + $table->text('content', 65535)->nullable(); |
|
| 20 | + $table->string('content_input_type')->nullable(); |
|
| 21 | + $table->string('dataenum')->nullable(); |
|
| 22 | + $table->string('helper')->nullable(); |
|
| 23 | + $table->timestamps(); |
|
| 24 | + $table->string('group_setting', 50)->nullable(); |
|
| 25 | + $table->string('label', 50)->nullable(); |
|
| 26 | + }); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Reverse the migrations. |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function down() |
|
| 36 | - { |
|
| 37 | - Schema::drop('cms_settings'); |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Reverse the migrations. |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function down() |
|
| 36 | + { |
|
| 37 | + Schema::drop('cms_settings'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function guardView($request) |
| 61 | 61 | { |
| 62 | - if ($request->is($this->url.'*') && ! CRUDBooster::canView()) { |
|
| 62 | + if ($request->is($this->url.'*') && !CRUDBooster::canView()) { |
|
| 63 | 63 | $this->stopIllegalAction('view'); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | private function guardCreate($request) |
| 71 | 71 | { |
| 72 | - if ($request->is($this->url.'/add*') && ! CRUDBooster::canCreate()) { |
|
| 72 | + if ($request->is($this->url.'/add*') && !CRUDBooster::canCreate()) { |
|
| 73 | 73 | $this->stopIllegalAction('add'); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function guardUpdate($request) |
| 81 | 81 | { |
| 82 | - if ($request->is($this->url.'/edit*') && ! CRUDBooster::canUpdate()) { |
|
| 82 | + if ($request->is($this->url.'/edit*') && !CRUDBooster::canUpdate()) { |
|
| 83 | 83 | $this->stopIllegalAction('edit'); |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function guardDelete($request) |
| 91 | 91 | { |
| 92 | - if ($request->is($this->url.'/delete*') && ! CRUDBooster::canDelete()) { |
|
| 92 | + if ($request->is($this->url.'/delete*') && !CRUDBooster::canDelete()) { |
|
| 93 | 93 | $this->stopIllegalAction('delete'); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function guardRead($request) |
| 101 | 101 | { |
| 102 | - if ($request->is($this->url.'/detail*') && ! CRUDBooster::canRead()) { |
|
| 102 | + if ($request->is($this->url.'/detail*') && !CRUDBooster::canRead()) { |
|
| 103 | 103 | $this->stopIllegalAction('view'); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -116,7 +116,7 @@ |
||
| 116 | 116 | */ |
| 117 | 117 | private function tokenMissMatchDevice($senderToken, $userAgent, $serverToken) |
| 118 | 118 | { |
| 119 | - if (! Cache::has($senderToken) || Cache::get($senderToken) == $userAgent) { |
|
| 119 | + if (!Cache::has($senderToken) || Cache::get($senderToken) == $userAgent) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | $result = []; |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | { |
| 20 | 20 | $adminPath = cbConfig('ADMIN_PATH', 'admin'); |
| 21 | 21 | |
| 22 | - if(CRUDBooster::myId()==''){ |
|
| 22 | + if (CRUDBooster::myId() == '') { |
|
| 23 | 23 | $url = url($adminPath.'/login'); |
| 24 | 24 | return redirect($url)->with('message', cbTrans('not_logged_in')); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if(!CRUDBooster::isSuperadmin()) { |
|
| 28 | - return redirect($adminPath)->with(['message'=> cbTrans('denied_access'),'message_type'=>'warning']); |
|
| 27 | + if (!CRUDBooster::isSuperadmin()) { |
|
| 28 | + return redirect($adminPath)->with(['message'=> cbTrans('denied_access'), 'message_type'=>'warning']); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(CRUDBooster::isLocked()){ |
|
| 31 | + if (CRUDBooster::isLocked()) { |
|
| 32 | 32 | return redirect(url($adminPath.'/lock-screen')); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function send($regID, $data) |
| 12 | 12 | { |
| 13 | - if (! $data['title'] || ! $data['content']) { |
|
| 13 | + if (!$data['title'] || !$data['content']) { |
|
| 14 | 14 | return 'title , content null !'; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -47,7 +47,6 @@ |
||
| 47 | 47 | * @param $template |
| 48 | 48 | * @param $subject |
| 49 | 49 | * @param $html |
| 50 | - |
|
| 51 | 50 | * @return bool |
| 52 | 51 | */ |
| 53 | 52 | private function putInQueue($config, $template, $subject, $html) |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | private function sendMail($html, $subject, $template) |
| 78 | 78 | { |
| 79 | - \Mail::send("crudbooster::emails.blank", ['content' => $html], function ($message) use ($subject, $template) { |
|
| 79 | + \Mail::send("crudbooster::emails.blank", ['content' => $html], function($message) use ($subject, $template) { |
|
| 80 | 80 | $message->priority(1); |
| 81 | 81 | $message->to($this->reciever); |
| 82 | 82 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $attachments = unserialize($queue->email_attachments); |
| 107 | 107 | |
| 108 | - \Mail::send("crudbooster::emails.blank", ['content' => $queue->email_content], function ($message) use ( |
|
| 108 | + \Mail::send("crudbooster::emails.blank", ['content' => $queue->email_content], function($message) use ( |
|
| 109 | 109 | $queue, |
| 110 | 110 | $attachments |
| 111 | 111 | ) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public static function myPrivilege() |
| 75 | 75 | { |
| 76 | 76 | $roles = session('admin_privileges_roles'); |
| 77 | - if (! $roles) { |
|
| 77 | + if (!$roles) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | foreach ($roles as $role) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | private static function getModulePath() |
| 88 | 88 | { |
| 89 | - $adminPathSegments = count(explode('/',cbConfig('ADMIN_PATH'))); |
|
| 89 | + $adminPathSegments = count(explode('/', cbConfig('ADMIN_PATH'))); |
|
| 90 | 90 | return Request::segment(1 + $adminPathSegments); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if (! $full) { |
|
| 280 | + if (!$full) { |
|
| 281 | 281 | $string = array_slice($string, 0, 1); |
| 282 | 282 | } |
| 283 | 283 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | public static function first($table, $id) |
| 298 | 298 | { |
| 299 | 299 | $table = self::parseSqlTable($table)['table']; |
| 300 | - if (! is_array($id)) { |
|
| 300 | + if (!is_array($id)) { |
|
| 301 | 301 | $pk = self::pk($table); |
| 302 | 302 | |
| 303 | 303 | return DB::table($table)->where($pk, $id)->first(); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $controllerName = basename($controllerName); |
| 431 | 431 | $route_url = route($controllerName.'GetIndex'); |
| 432 | 432 | |
| 433 | - if (! $path) { |
|
| 433 | + if (!$path) { |
|
| 434 | 434 | return trim($route_url, '/'); |
| 435 | 435 | } |
| 436 | 436 | |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | @$get = $_GET; |
| 491 | 491 | $inputhtml = ''; |
| 492 | 492 | |
| 493 | - if (! $get) { |
|
| 493 | + if (!$get) { |
|
| 494 | 494 | return $inputhtml; |
| 495 | 495 | } |
| 496 | 496 | if (is_array($exception)) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public static function findPK($table) |
| 17 | 17 | { |
| 18 | - if (! $table) { |
|
| 18 | + if (!$table) { |
|
| 19 | 19 | return 'id'; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | $table = CRUDBooster::parseSqlTable($table); |
| 26 | 26 | |
| 27 | - if (! $table['table']) { |
|
| 27 | + if (!$table['table']) { |
|
| 28 | 28 | throw new \Exception("parseSqlTable can't determine the table"); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $primary_key = self::findPKname($table); |
| 32 | 32 | |
| 33 | - if (! $primary_key) { |
|
| 33 | + if (!$primary_key) { |
|
| 34 | 34 | return 'id'; |
| 35 | 35 | } |
| 36 | 36 | CRUDBooster::putCache('table_'.$table, 'primary_key', $primary_key); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $cols = collect(DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = :database AND TABLE_NAME = :table', [ |
| 101 | 101 | 'database' => $table['database'], |
| 102 | 102 | 'table' => $table['table'], |
| 103 | - ]))->map(function ($x) { |
|
| 103 | + ]))->map(function($x) { |
|
| 104 | 104 | return (array) $x; |
| 105 | 105 | })->toArray(); |
| 106 | 106 | |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public static function colExists($table, $field) |
| 116 | 116 | { |
| 117 | - if (! $table) { |
|
| 117 | + if (!$table) { |
|
| 118 | 118 | throw new Exception("\$table is empty !", 1); |
| 119 | 119 | } |
| 120 | - if (! $field) { |
|
| 120 | + if (!$field) { |
|
| 121 | 121 | throw new Exception("\$field is empty !", 1); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $field = 'field_type_'.$table.'_'.$field; |
| 155 | 155 | |
| 156 | - return Cache::rememberForever($field, function () use ($table, $field) { |
|
| 156 | + return Cache::rememberForever($field, function() use ($table, $field) { |
|
| 157 | 157 | try { |
| 158 | 158 | //MySQL & SQL Server |
| 159 | 159 | $typedata = DB::select(DB::raw("select DATA_TYPE from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='$table' and COLUMN_NAME = '$field'"))[0]->DATA_TYPE; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $table = CRUDBooster::getTableForeignKey($fieldName); |
| 181 | - if (! $table) { |
|
| 181 | + if (!$table) { |
|
| 182 | 182 | return false; |
| 183 | 183 | } |
| 184 | 184 | |