@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $template = file_get_contents(__DIR__."/../templates/FooBarController.stub"); |
44 | 44 | |
45 | 45 | //Replace table |
46 | - $template = str_replace("{table}",'"'.$this->table.'"', $template); |
|
46 | + $template = str_replace("{table}", '"'.$this->table.'"', $template); |
|
47 | 47 | |
48 | 48 | //Replace permalink |
49 | 49 | $template = str_replace("{permalink}", '"'.$this->table.'"', $template); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | //Replace scaffolding |
52 | 52 | $fields = DB::getSchemaBuilder()->getColumnListing($this->table); |
53 | 53 | $scaffold = ""; |
54 | - foreach($fields as $field) { |
|
54 | + foreach ($fields as $field) { |
|
55 | 55 | $scaffold .= '$this->addText("'.$field.'");'."\n\t\t"; |
56 | 56 | } |
57 | 57 | $template = str_replace("{scaffolding}", $scaffold, $template); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | //Save to database |
68 | 68 | $module = []; |
69 | - $module['name'] = ($this->name)?:ucwords(str_replace("_"," ",$this->table)); |
|
69 | + $module['name'] = ($this->name) ?: ucwords(str_replace("_", " ", $this->table)); |
|
70 | 70 | $module['icon'] = $this->icon; |
71 | 71 | $module['table_name'] = $this->table; |
72 | 72 | $module['controller'] = $filename; |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | public function indexRender($row, $column) |
22 | 22 | { |
23 | - if($column->getFormat()) { |
|
23 | + if ($column->getFormat()) { |
|
24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
25 | - }else{ |
|
25 | + } else { |
|
26 | 26 | return $row->{$column->getField()}; |
27 | 27 | } |
28 | 28 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | if($column->getFormat()) { |
24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
25 | - }else{ |
|
25 | + } else{ |
|
26 | 26 | return $row->{$column->getField()}; |
27 | 27 | } |
28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
36 | 36 | $data = DB::table($table); |
37 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
37 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | 39 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
40 | 40 | $data->whereRaw($SQLCondition); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $data = $data->get(); |
43 | 43 | $options = []; |
44 | 44 | foreach ($data as $d) { |
45 | - $options[ $d->$key_field ] = $d->$display_field; |
|
45 | + $options[$d->$key_field] = $d->$display_field; |
|
46 | 46 | } |
47 | 47 | $this->options($options); |
48 | 48 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $data = DB::table($table); |
37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
40 | 40 | $data->whereRaw($SQLCondition); |
41 | 41 | } |
42 | 42 | $data = $data->get(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
27 | 27 | $data = DB::table($table); |
28 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
28 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
29 | 29 | $data = call_user_func($SQLCondition, $data); |
30 | 30 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
31 | 31 | $data->whereRaw($SQLCondition); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $data = $data->get(); |
34 | 34 | $options = []; |
35 | 35 | foreach ($data as $d) { |
36 | - $options[ $d->$key_field ] = $d->$display_field; |
|
36 | + $options[$d->$key_field] = $d->$display_field; |
|
37 | 37 | } |
38 | 38 | $data = columnSingleton()->getColumn($this->index); |
39 | 39 | /** @var $data SelectModel */ |
40 | - $data->setOptionsFromTable(["table"=>$table,"key_field"=>$key_field,"display_field"=>$display_field]); |
|
40 | + $data->setOptionsFromTable(["table"=>$table, "key_field"=>$key_field, "display_field"=>$display_field]); |
|
41 | 41 | columnSingleton()->setColumn($this->index, $data); |
42 | 42 | |
43 | 43 | $this->options($options); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $data = DB::table($table); |
37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
40 | 40 | $data->whereRaw($SQLCondition); |
41 | 41 | } |
42 | 42 | $data = $data->get(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function query($query, $column) |
21 | 21 | { |
22 | - if($column->getOptionsFromTable()) { |
|
22 | + if ($column->getOptionsFromTable()) { |
|
23 | 23 | $option = $column->getOptionsFromTable(); |
24 | - $query->join($option["table"],$option["table"].'.'.$option["key_field"],"=", $column->getName()); |
|
24 | + $query->join($option["table"], $option["table"].'.'.$option["key_field"], "=", $column->getName()); |
|
25 | 25 | $query->addSelect($option['table'].'.'.$option['display_field'].' as '.$option['table'].'_'.$option['display_field']); |
26 | 26 | } |
27 | 27 | return $query; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function indexRender($row, $column) |
35 | 35 | { |
36 | - if($column->getOptionsFromTable()) { |
|
36 | + if ($column->getOptionsFromTable()) { |
|
37 | 37 | $option = $column->getOptionsFromTable(); |
38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
39 | - }else{ |
|
39 | + } else { |
|
40 | 40 | $option = $column->getOptions(); |
41 | 41 | $key = $row->{ $column->getField() }; |
42 | - return @$option[ $key ]; |
|
42 | + return @$option[$key]; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | if($column->getOptionsFromTable()) { |
37 | 37 | $option = $column->getOptionsFromTable(); |
38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $option = $column->getOptions(); |
41 | 41 | $key = $row->{ $column->getField() }; |
42 | 42 | return @$option[ $key ]; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('cb_menus', function (Blueprint $table) { |
|
15 | + Schema::create('cb_menus', function(Blueprint $table) { |
|
16 | 16 | $table->increments("id"); |
17 | 17 | $table->string('name'); |
18 | 18 | $table->string("icon")->nullable(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
36 | 36 | $data = DB::table($table); |
37 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
37 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | 39 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
40 | 40 | $data->whereRaw($SQLCondition); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $data = $data->get(); |
43 | 43 | $options = []; |
44 | 44 | foreach ($data as $d) { |
45 | - $options[ $d->$key_field ] = $d->$display_field; |
|
45 | + $options[$d->$key_field] = $d->$display_field; |
|
46 | 46 | } |
47 | 47 | $this->options($options); |
48 | 48 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $data = DB::table($table); |
37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
40 | 40 | $data->whereRaw($SQLCondition); |
41 | 41 | } |
42 | 42 | $data = $data->get(); |
@@ -20,9 +20,9 @@ |
||
20 | 20 | */ |
21 | 21 | public function indexRender($row, $column) |
22 | 22 | { |
23 | - if($column->getFormat()) { |
|
23 | + if ($column->getFormat()) { |
|
24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
25 | - }else{ |
|
25 | + } else { |
|
26 | 26 | return $row->{$column->getField()}; |
27 | 27 | } |
28 | 28 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | if($column->getFormat()) { |
24 | 24 | return date($column->getFormat(), strtotime($row->{$column->getField()})); |
25 | - }else{ |
|
25 | + } else{ |
|
26 | 26 | return $row->{$column->getField()}; |
27 | 27 | } |
28 | 28 | } |
@@ -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 |
@@ -28,8 +28,11 @@ |
||
28 | 28 | { |
29 | 29 | $user = $this->user(); |
30 | 30 | $role = cb()->find("cb_roles", $user->cb_roles_id); |
31 | - if($role) return $role->name; |
|
32 | - else return null; |
|
31 | + if($role) { |
|
32 | + return $role->name; |
|
33 | + } else { |
|
34 | + return null; |
|
35 | + } |
|
33 | 36 | } |
34 | 37 | |
35 | 38 | public function roleId() |