@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace crocodicstudio\crudbooster\helpers; |
| 3 | 3 | |
| 4 | -class UserSession { |
|
| 4 | +class UserSession { |
|
| 5 | 5 | |
| 6 | 6 | public function user() |
| 7 | 7 | { |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | public function photo() |
| 22 | 22 | { |
| 23 | 23 | $user = $this->user(); |
| 24 | - return ($user->photo)?asset($user->photo):asset(dummyPhoto()); |
|
| 24 | + return ($user->photo) ?asset($user->photo) : asset(dummyPhoto()); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function roleName() |
| 28 | 28 | { |
| 29 | 29 | $user = $this->user(); |
| 30 | 30 | $role = cb()->find("cb_roles", $user->cb_roles_id); |
| 31 | - if($role) return $role->name; |
|
| 31 | + if ($role) return $role->name; |
|
| 32 | 32 | else return null; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | <?php /** @var \crocodicstudio\crudbooster\types\radio\RadioModel $column */ ?> |
| 3 | 3 | @foreach($column->getOptions() as $key=>$value) |
| 4 | 4 | <?php |
| 5 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
| 5 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
| 6 | 6 | ?> |
| 7 | 7 | <div class="{{ $column->getDisabled()?"disabled":"" }}"> |
| 8 | 8 | <label class='radio-inline'> |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function assignment($value, $column) |
| 22 | 22 | { |
| 23 | - return @implode(";", request( $column->getName() )); |
|
| 23 | + return @implode(";", request($column->getName())); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | private function name($label, $name = null) |
| 20 | 20 | { |
| 21 | - return (!$name)?strtolower(slug($label,"_")):$name; |
|
| 21 | + return (!$name) ?strtolower(slug($label, "_")) : $name; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $model->setShowAdd(true); |
| 40 | 40 | $model->setShowEdit(true); |
| 41 | 41 | $model->setShowDetail(true); |
| 42 | - $model->setIndexDisplayTransform(function ($value, $row) { return $value; }); |
|
| 43 | - $model->setDetailDisplayTransform(function ($value, $row) { return $value; }); |
|
| 42 | + $model->setIndexDisplayTransform(function($value, $row) { return $value; }); |
|
| 43 | + $model->setDetailDisplayTransform(function($value, $row) { return $value; }); |
|
| 44 | 44 | return $model; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function indexRender($row, $column) |
| 28 | 28 | { |
| 29 | - return (isset($row->{$column->getField()}))?$row->{ $column->getField() }:null; |
|
| 29 | + return (isset($row->{$column->getField()})) ? $row->{ $column->getField() }:null; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function detailRender($row, $column) |
| 33 | 33 | { |
| 34 | - return (isset($row->{$column->getField()}))?$row->{ $column->getField() }:null; |
|
| 34 | + return (isset($row->{$column->getField()})) ? $row->{ $column->getField() }:null; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -149,21 +149,21 @@ |
||
| 149 | 149 | <?php |
| 150 | 150 | $font = new \crocodicstudio\crudbooster\helpers\FontAwesome(); |
| 151 | 151 | $fontData = [ |
| 152 | - ["data"=>$font->text(),"label"=>"Text"], |
|
| 153 | - ["data"=>$font->web(),"label"=>"Web"], |
|
| 154 | - ["data"=>$font->video(),"label"=>"Video"], |
|
| 155 | - ["data"=>$font->transportation(),"label"=>"Transportation"], |
|
| 156 | - ["data"=>$font->payment(),"label"=>"Payment"], |
|
| 157 | - ["data"=>$font->medical(),"label"=>"Medical"], |
|
| 158 | - ["data"=>$font->hand(),"label"=>"Hand"], |
|
| 159 | - ["data"=>$font->fileType(),"label"=>"File Type"], |
|
| 160 | - ["data"=>$font->directional(),"label"=>"Directional"], |
|
| 161 | - ["data"=>$font->currency(),"label"=>"Currency"], |
|
| 162 | - ["data"=>$font->chart(),"label"=>"Chart"], |
|
| 163 | - ["data"=>$font->brands(),"label"=>"Brand"], |
|
| 164 | - ["data"=>$font->gender(),"label"=>"Gender"], |
|
| 165 | - ["data"=>$font->form(),"label"=>"Form"], |
|
| 166 | - ["data"=>$font->spinner(),"label"=>"Spinner"] |
|
| 152 | + ["data"=>$font->text(), "label"=>"Text"], |
|
| 153 | + ["data"=>$font->web(), "label"=>"Web"], |
|
| 154 | + ["data"=>$font->video(), "label"=>"Video"], |
|
| 155 | + ["data"=>$font->transportation(), "label"=>"Transportation"], |
|
| 156 | + ["data"=>$font->payment(), "label"=>"Payment"], |
|
| 157 | + ["data"=>$font->medical(), "label"=>"Medical"], |
|
| 158 | + ["data"=>$font->hand(), "label"=>"Hand"], |
|
| 159 | + ["data"=>$font->fileType(), "label"=>"File Type"], |
|
| 160 | + ["data"=>$font->directional(), "label"=>"Directional"], |
|
| 161 | + ["data"=>$font->currency(), "label"=>"Currency"], |
|
| 162 | + ["data"=>$font->chart(), "label"=>"Chart"], |
|
| 163 | + ["data"=>$font->brands(), "label"=>"Brand"], |
|
| 164 | + ["data"=>$font->gender(), "label"=>"Gender"], |
|
| 165 | + ["data"=>$font->form(), "label"=>"Form"], |
|
| 166 | + ["data"=>$font->spinner(), "label"=>"Spinner"] |
|
| 167 | 167 | ]; |
| 168 | 168 | ?> |
| 169 | 169 | @foreach($fontData as $f) |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | public function handle() |
| 33 | 33 | { |
| 34 | 34 | |
| 35 | - if($this->option("generate")) { |
|
| 35 | + if ($this->option("generate")) { |
|
| 36 | 36 | $this->info("== Generating Seeder =="); |
| 37 | 37 | $this->generateSeeder(); |
| 38 | 38 | $this->info("== Finish =="); |
| 39 | - }else{ |
|
| 39 | + } else { |
|
| 40 | 40 | $this->info("== Importing the seeder =="); |
| 41 | - $this->call("db:seed",["--class"=>"CbMigrationSeeder"]); |
|
| 41 | + $this->call("db:seed", ["--class"=>"CbMigrationSeeder"]); |
|
| 42 | 42 | $this->info("== Finish =="); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | $php_string = ""; |
| 51 | 51 | $additional_tables = cbConfig("ADDITIONAL_DATA_MIGRATION"); |
| 52 | 52 | |
| 53 | - foreach($tables as $table) { |
|
| 54 | - if(substr($table,0,3) == "cb_" || in_array($table, $additional_tables)) { |
|
| 53 | + foreach ($tables as $table) { |
|
| 54 | + if (substr($table, 0, 3) == "cb_" || in_array($table, $additional_tables)) { |
|
| 55 | 55 | $this->info("Create seeder for table : ".$table); |
| 56 | 56 | $rows = DB::table($table)->get(); |
| 57 | 57 | $data = []; |
| 58 | - foreach($rows as $i=>$row) { |
|
| 58 | + foreach ($rows as $i=>$row) { |
|
| 59 | 59 | $data[$i] = []; |
| 60 | - foreach($row as $key=>$val) { |
|
| 60 | + foreach ($row as $key=>$val) { |
|
| 61 | 61 | $data[$i][$key] = $val; |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - if(count($data)!=0) { |
|
| 64 | + if (count($data) != 0) { |
|
| 65 | 65 | $php_string .= 'DB::table(\''.$table.'\')->delete();'."\n\t\t\t"; |
| 66 | 66 | $php_string .= 'DB::table(\''.$table.'\')->insert('.min_var_export($data).');'."\n\t\t\t"; |
| 67 | 67 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $composer_path = ''; |
| 92 | 92 | if (file_exists(getcwd().'/composer.phar')) { |
| 93 | 93 | $composer_path = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
| 94 | - }else{ |
|
| 94 | + } else { |
|
| 95 | 95 | $composer_path = 'composer'; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -32,12 +32,12 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $this->info($this->description); |
| 34 | 34 | $option = $this->option("module"); |
| 35 | - if($option == "ALL") { |
|
| 35 | + if ($option == "ALL") { |
|
| 36 | 36 | $tables = DB::connection()->getDoctrineSchemaManager()->listTableNames(); |
| 37 | - foreach($tables as $table) { |
|
| 37 | + foreach ($tables as $table) { |
|
| 38 | 38 | $this->generate($table); |
| 39 | 39 | } |
| 40 | - }else{ |
|
| 40 | + } else { |
|
| 41 | 41 | $this->generate($option); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
| 37 | 37 | |
| 38 | - if(strpos($table,"App\Models")!==false) { |
|
| 38 | + if (strpos($table, "App\Models") !== false) { |
|
| 39 | 39 | $table = new $table(); |
| 40 | 40 | $table = $table::$tableName; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $data = DB::table($table); |
| 44 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
| 44 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
| 45 | 45 | $data = call_user_func($SQLCondition, $data); |
| 46 | 46 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
| 47 | 47 | $data->whereRaw($SQLCondition); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $data = $data->get(); |
| 50 | 50 | $options = []; |
| 51 | 51 | foreach ($data as $d) { |
| 52 | - $options[ $d->$key_field ] = $d->$display_field; |
|
| 52 | + $options[$d->$key_field] = $d->$display_field; |
|
| 53 | 53 | } |
| 54 | 54 | $this->options($options); |
| 55 | 55 | } |