@@ -22,7 +22,7 @@ |
||
| 22 | 22 | public function indexRender($row, $column) |
| 23 | 23 | { |
| 24 | 24 | $value = trim(strip_tags($row->{ $column->getField() })); |
| 25 | - if($column->getLimit()) { |
|
| 25 | + if ($column->getLimit()) { |
|
| 26 | 26 | $value = Str::limit($value, $column->getLimit()); |
| 27 | 27 | } |
| 28 | 28 | return $value; |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | $foreignValue = request('foreign_value'); |
| 19 | 19 | $table = decrypt(request('table')); |
| 20 | 20 | $sqlCondition = decrypt(request('sql_condition')); |
| 21 | - if($foreignKey && $foreignValue && $table) { |
|
| 21 | + if ($foreignKey && $foreignValue && $table) { |
|
| 22 | 22 | |
| 23 | 23 | $data = DB::table($table) |
| 24 | 24 | ->where($foreignKey, $foreignValue); |
| 25 | - if($sqlCondition) { |
|
| 25 | + if ($sqlCondition) { |
|
| 26 | 26 | $data->whereRaw($sqlCondition); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | return response()->json(['status'=>true, 'data'=>$data]); |
| 32 | 32 | |
| 33 | - }else{ |
|
| 33 | + } else { |
|
| 34 | 34 | return response()->json(['status'=>false]); |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function optionsFromTable($table, $key_field, $display_field, $SQLCondition = null) { |
| 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,11 +49,11 @@ 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 | $data = columnSingleton()->getColumn($this->index); |
| 55 | 55 | /** @var $data SelectModel */ |
| 56 | - $data->setOptionsFromTable(["table"=>$table,"key_field"=>$key_field,"display_field"=>$display_field,"sql_condition"=>$SQLCondition]); |
|
| 56 | + $data->setOptionsFromTable(["table"=>$table, "key_field"=>$key_field, "display_field"=>$display_field, "sql_condition"=>$SQLCondition]); |
|
| 57 | 57 | columnSingleton()->setColumn($this->index, $data); |
| 58 | 58 | |
| 59 | 59 | $this->options($options); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -cb()->routeGroupBackend(function () { |
|
| 4 | - cb()->routePost("select-lookup",'\crocodicstudio\crudbooster\types\select\SelectController@postLookup'); |
|
| 3 | +cb()->routeGroupBackend(function() { |
|
| 4 | + cb()->routePost("select-lookup", '\crocodicstudio\crudbooster\types\select\SelectController@postLookup'); |
|
| 5 | 5 | }); |
| 6 | 6 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
| 9 | 9 | @if(!$column->getForeignKey()) |
| 10 | 10 | <?php |
| 11 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
| 11 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
| 12 | 12 | ?> |
| 13 | 13 | @foreach($column->getOptions() as $key=>$value) |
| 14 | 14 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |