diff --git a/README.md b/README.md index 4f87f4f..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,11 +0,0 @@ -Laravel Generator -============================== - -[![Total Downloads](https://poser.pugx.org/infyomlabs/laravel-generator/downloads)](https://packagist.org/packages/infyomlabs/laravel-generator) -[![Monthly Downloads](https://poser.pugx.org/infyomlabs/laravel-generator/d/monthly)](https://packagist.org/packages/infyomlabs/laravel-generator) -[![Daily Downloads](https://poser.pugx.org/infyomlabs/laravel-generator/d/daily)](https://packagist.org/packages/infyomlabs/laravel-generator) -[![Latest Stable Version](https://poser.pugx.org/infyomlabs/laravel-generator/v/stable)](https://packagist.org/packages/infyomlabs/laravel-generator) -[![Latest Unstable Version](https://poser.pugx.org/infyomlabs/laravel-generator/v/unstable)](https://packagist.org/packages/infyomlabs/laravel-generator) -[![License](https://poser.pugx.org/infyomlabs/laravel-generator/license)](https://packagist.org/packages/infyomlabs/laravel-generator) - -Documentation is located [here](http://labs.infyom.com/laravelgenerator) diff --git a/src/Commands/Publish/VueJsLayoutPublishCommand.php b/src/Commands/Publish/VueJsLayoutPublishCommand.php index 39d030f..b017769 100644 --- a/src/Commands/Publish/VueJsLayoutPublishCommand.php +++ b/src/Commands/Publish/VueJsLayoutPublishCommand.php @@ -3,6 +3,7 @@ namespace InfyOm\Generator\Commands\Publish; use InfyOm\Generator\Utils\FileUtil; +use Illuminate\Support\Str; class VueJsLayoutPublishCommand extends PublishBaseCommand { @@ -35,7 +36,7 @@ class VueJsLayoutPublishCommand extends PublishBaseCommand public function handle() { $version = $this->getApplication()->getVersion(); - if (str_contains($version, '5.1')) { + if (Str::contains($version, '5.1')) { $this->laravelVersion = '5.1'; } else { $this->laravelVersion = '5.2'; diff --git a/src/Common/BaseRepository.php b/src/Common/BaseRepository.php index 1737cbb..d0621ae 100644 --- a/src/Common/BaseRepository.php +++ b/src/Common/BaseRepository.php @@ -3,6 +3,7 @@ namespace InfyOm\Generator\Common; use Exception; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Log; abstract class BaseRepository extends \Prettus\Repository\Eloquent\BaseRepository @@ -54,11 +55,10 @@ public function updateRelations($model, $attributes) $methodClass = get_class($model->$key($key)); switch ($methodClass) { case 'Illuminate\Database\Eloquent\Relations\BelongsToMany': - $new_values = array_get($attributes, $key, []); + $new_values = Arr::get($attributes, $key, []); if (array_search('', $new_values) !== false) { unset($new_values[array_search('', $new_values)]); } - Log::info(array_values($new_values)); // if(count(array_values($new_values)) === 0){ // $pivot = $model->$key()->detach(array_values($new_values)); // }else{ @@ -71,7 +71,7 @@ public function updateRelations($model, $attributes) break; case 'Illuminate\Database\Eloquent\Relations\BelongsTo': $model_key = $model->$key()->getQualifiedForeignKey(); - $new_value = array_get($attributes, $key, null); + $new_value = Arr::get($attributes, $key, null); $new_value = $new_value == '' ? null : $new_value; $model->$model_key = $new_value; break; @@ -80,7 +80,7 @@ public function updateRelations($model, $attributes) case 'Illuminate\Database\Eloquent\Relations\HasOneOrMany': break; case 'Illuminate\Database\Eloquent\Relations\HasMany': - $new_values = array_get($attributes, $key, []); + $new_values = Arr::get($attributes, $key, []); if (array_search('', $new_values) !== false) { unset($new_values[array_search('', $new_values)]); } diff --git a/src/Common/GeneratorConfig.php b/src/Common/GeneratorConfig.php index 925af63..42d2154 100644 --- a/src/Common/GeneratorConfig.php +++ b/src/Common/GeneratorConfig.php @@ -304,8 +304,8 @@ public function prepareModelNames() $this->mDashedPlural = str_replace('_', '-', Str::snake($this->mSnakePlural)); $this->mSlash = str_replace('_', '/', Str::snake($this->mSnake)); $this->mSlashPlural = str_replace('_', '/', Str::snake($this->mSnakePlural)); - $this->mHuman = title_case(str_replace('_', ' ', Str::snake($this->mSnake))); - $this->mHumanPlural = title_case(str_replace('_', ' ', Str::snake($this->mSnakePlural))); + $this->mHuman = Str::title(str_replace('_', ' ', Str::snake($this->mSnake))); + $this->mHumanPlural = Str::title(str_replace('_', ' ', Str::snake($this->mSnakePlural))); } public function prepareOptions(CommandData &$commandData) diff --git a/src/Common/GeneratorFieldRelation.php b/src/Common/GeneratorFieldRelation.php index efa7deb..055ce35 100644 --- a/src/Common/GeneratorFieldRelation.php +++ b/src/Common/GeneratorFieldRelation.php @@ -1,6 +1,7 @@ inputs[0]; switch ($this->type) { case '1t1': - $functionName = camel_case($modelName); + $functionName = Str::camel($modelName); $relation = 'hasOne'; $relationClass = 'HasOne'; break; case '1tm': - $functionName = camel_case(str_plural($modelName)); + $functionName = Str::camel(Str::plural($modelName)); $relation = 'hasMany'; $relationClass = 'HasMany'; break; case 'mt1': - $functionName = camel_case($modelName); + $functionName = Str::camel($modelName); $relation = 'belongsTo'; $relationClass = 'BelongsTo'; break; case 'mtm': - $functionName = camel_case(str_plural($modelName)); + $functionName = Str::camel(Str::plural($modelName)); $relation = 'belongsToMany'; $relationClass = 'BelongsToMany'; break; case 'hmt': - $functionName = camel_case(str_plural($modelName)); + $functionName = Str::camel(Str::plural($modelName)); $relation = 'hasManyThrough'; $relationClass = 'HasManyThrough'; break; diff --git a/src/Generators/ModelGenerator.php b/src/Generators/ModelGenerator.php index dc9982d..b8e068d 100644 --- a/src/Generators/ModelGenerator.php +++ b/src/Generators/ModelGenerator.php @@ -3,6 +3,7 @@ namespace InfyOm\Generator\Generators; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Str; use InfyOm\Generator\Common\CommandData; use InfyOm\Generator\Common\GeneratorFieldRelation; use InfyOm\Generator\Utils\FileUtil; @@ -192,12 +193,12 @@ private function getPHPDocType($db_type, $relation = null) return 'string'; case '1t1': case 'mt1': - return '\\'.$this->commandData->config->nsModel.'\\'.$relation->inputs[0].' '.camel_case($relation->inputs[0]); + return '\\'.$this->commandData->config->nsModel.'\\'.$relation->inputs[0].' '.Str::camel($relation->inputs[0]); case '1tm': return '\Illuminate\Database\Eloquent\Collection'.' '.$relation->inputs[0]; case 'mtm': case 'hmt': - return '\Illuminate\Database\Eloquent\Collection'.' '.camel_case($relation->inputs[0]); + return '\Illuminate\Database\Eloquent\Collection'.' '.Str::camel($relation->inputs[0]); default: return $db_type; } @@ -231,7 +232,7 @@ private function generateRequiredFields() foreach ($this->commandData->fields as $field) { if (!empty($field->validations)) { - if (str_contains($field->validations, 'required')) { + if (Str::contains($field->validations, 'required')) { $requiredFields[] = $field->name; } } diff --git a/src/Generators/Scaffold/ViewGenerator.php b/src/Generators/Scaffold/ViewGenerator.php index aed1bd4..107f6a9 100644 --- a/src/Generators/Scaffold/ViewGenerator.php +++ b/src/Generators/Scaffold/ViewGenerator.php @@ -219,7 +219,7 @@ private function getTransArray($string = ''){ } return $result; } - + private function getLangArray(){ $mSnake = $this->commandData->config->mSnake; $lang = [ @@ -231,7 +231,7 @@ private function getLangArray(){ $mSnake."_create" => $this->getTransArray('Create '.$this->commandData->config->mHuman), ]; foreach ($this->commandData->fields as $field) { - $title = preg_replace('/-|_/',' ',title_case($field->name)); + $title = preg_replace('/-|_/',' ',Str::title($field->name)); if($field->inIndex || $field->inForm){ $lang[$mSnake.'_'.$field->name] = $this->getTransArray($title); } @@ -246,7 +246,7 @@ private function getLangArray(){ private function generateFields() { $this->htmlFields = []; - $startSeparator = '
'; + $startSeparator = '
'; $endSeparator = '
'; foreach ($this->commandData->fields as $field) { @@ -362,7 +362,7 @@ public function generateCustomField($fields) $this->htmlFields = []; // $this->commandData = new CommandData($this->commandData, CommandData::$COMMAND_TYPE_API_SCAFFOLD); // $this->commandData->commandType = CommandData::$COMMAND_TYPE_API_SCAFFOLD; - $startSeparator = '
'; + $startSeparator = '
'; $endSeparator = '
'; foreach ($fields as $field) { diff --git a/src/Utils/HTMLFieldGenerator.php b/src/Utils/HTMLFieldGenerator.php index c6515d1..e266fd2 100644 --- a/src/Utils/HTMLFieldGenerator.php +++ b/src/Utils/HTMLFieldGenerator.php @@ -3,6 +3,7 @@ namespace InfyOm\Generator\Utils; use InfyOm\Generator\Common\GeneratorField; +use Illuminate\Support\Str; class HTMLFieldGenerator { @@ -29,7 +30,7 @@ public static function generateHTML(GeneratorField $field, $templateType) } else { $fieldTemplate = get_template('scaffold.fields.select', $templateType); } - if (starts_with($field->htmlValues[0], '$')) { + if (Str::startsWith($field->htmlValues[0], '$')) { $fieldTemplate = str_replace( '$INPUT_ARR$', $field->htmlValues[0], @@ -37,7 +38,7 @@ public static function generateHTML(GeneratorField $field, $templateType) ); $fieldTemplate = str_replace( '$INPUT_ARR_SELECTED$', - str_plural($field->htmlValues[0]) . 'Selected', + Str::plural($field->htmlValues[0]) . 'Selected', $fieldTemplate ); } else { @@ -105,7 +106,7 @@ public static function generateCustomFieldHTML(GeneratorField $field, $templateT } else { $fieldTemplate = get_template('scaffold.custom_fields.select', $templateType); } - if (starts_with($field->htmlValues[0], '$')) { + if (Str::startsWith($field->htmlValues[0], '$')) { $fieldTemplate = str_replace( '$INPUT_ARR$', $field->htmlValues[0], @@ -113,7 +114,7 @@ public static function generateCustomFieldHTML(GeneratorField $field, $templateT ); $fieldTemplate = str_replace( '$INPUT_ARR_SELECTED$', - str_plural($field->htmlValues[0]) . 'Selected', + Str::plural($field->htmlValues[0]) . 'Selected', $fieldTemplate ); } else { diff --git a/src/helpers.php b/src/helpers.php index 9426d0f..344507e 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -1,4 +1,5 @@ studly_case($modelName), - '$RELATION_MODEL_SNAKE$' => snake_case($modelName) + '$RELATION_MODEL$' => Str::studly($modelName), + '$RELATION_MODEL_SNAKE$' => Str::snake($modelName) ], $addRepositoryTemplate); $addRepositoryTemplate = preg_split('/#{3}/', $addRepositoryTemplate); diff --git a/templates/api/controller/api_controller.stub b/templates/api/controller/api_controller.stub index 44a5478..5e21d0b 100644 --- a/templates/api/controller/api_controller.stub +++ b/templates/api/controller/api_controller.stub @@ -11,7 +11,6 @@ use InfyOm\Generator\Criteria\LimitOffsetCriteria; use Prettus\Repository\Criteria\RequestCriteria; use Illuminate\Support\Facades\Response; use Prettus\Repository\Exceptions\RepositoryException; -use Flash; $DOC_CONTROLLER$ class $MODEL_NAME$APIController extends Controller @@ -31,7 +30,7 @@ class $MODEL_NAME$APIController extends Controller $this->$MODEL_NAME_CAMEL$Repository->pushCriteria(new RequestCriteria($request)); $this->$MODEL_NAME_CAMEL$Repository->pushCriteria(new LimitOffsetCriteria($request)); } catch (RepositoryException $e) { - Flash::error($e->getMessage()); + return $this->sendError($e->getMessage()); } $$MODEL_NAME_PLURAL_CAMEL$ = $this->$MODEL_NAME_CAMEL$Repository->all(); diff --git a/templates/scaffold/auth/login.stub b/templates/scaffold/auth/login.stub index c35780b..02d7a79 100644 --- a/templates/scaffold/auth/login.stub +++ b/templates/scaffold/auth/login.stub @@ -103,16 +103,5 @@ - - - - \ No newline at end of file + diff --git a/templates/scaffold/auth/register.stub b/templates/scaffold/auth/register.stub index d98122d..59345f1 100644 --- a/templates/scaffold/auth/register.stub +++ b/templates/scaffold/auth/register.stub @@ -123,17 +123,6 @@ - - - diff --git a/templates/scaffold/custom_fields/boolean.stub b/templates/scaffold/custom_fields/boolean.stub index a6137c1..03fbba8 100644 --- a/templates/scaffold/custom_fields/boolean.stub +++ b/templates/scaffold/custom_fields/boolean.stub @@ -1,10 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
- -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} {!! Form::hidden('$FIELD_NAME$', 0, ['id'=>"hidden_$FIELD_NAME$"]) !!} +
+ {!! Form::checkbox('$FIELD_NAME$', 1, null) !!} +
diff --git a/templates/scaffold/custom_fields/checkbox.stub b/templates/scaffold/custom_fields/checkbox.stub index bbfb105..99ececc 100644 --- a/templates/scaffold/custom_fields/checkbox.stub +++ b/templates/scaffold/custom_fields/checkbox.stub @@ -1,10 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
- -
-
\ No newline at end of file +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} {!! Form::hidden('$FIELD_NAME$', 0, ['id'=>"hidden_$FIELD_NAME$"]) !!} +
+ {!! Form::checkbox('$FIELD_NAME$', 1, null) !!} +
+
diff --git a/templates/scaffold/custom_fields/checkbox_group.stub b/templates/scaffold/custom_fields/checkbox_group.stub index 4c7590a..88979ad 100644 --- a/templates/scaffold/custom_fields/checkbox_group.stub +++ b/templates/scaffold/custom_fields/checkbox_group.stub @@ -1,5 +1,5 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} $CHECKBOXES$ -
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/date.stub b/templates/scaffold/custom_fields/date.stub index d4bf942..4a1db29 100644 --- a/templates/scaffold/custom_fields/date.stub +++ b/templates/scaffold/custom_fields/date.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::date('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/email.stub b/templates/scaffold/custom_fields/email.stub index 97e7e46..b66b907 100644 --- a/templates/scaffold/custom_fields/email.stub +++ b/templates/scaffold/custom_fields/email.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::email('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/file.stub b/templates/scaffold/custom_fields/file.stub index e6ae277..d024ea8 100644 --- a/templates/scaffold/custom_fields/file.stub +++ b/templates/scaffold/custom_fields/file.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
@@ -54,4 +54,4 @@ dz_$RANDOM_VARIABLE$[0].mockFile = $RANDOM_VARIABLE$; dropzoneFields['$FIELD_NAME$'] = dz_$RANDOM_VARIABLE$; -@endprepend \ No newline at end of file +@endprepend diff --git a/templates/scaffold/custom_fields/number.stub b/templates/scaffold/custom_fields/number.stub index ddf4659..8f78e46 100644 --- a/templates/scaffold/custom_fields/number.stub +++ b/templates/scaffold/custom_fields/number.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
- {!! Form::number('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!} -
- {{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
+ {!! Form::number('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','step'=>'any','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!} +
+ {{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }} +
-
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/password.stub b/templates/scaffold/custom_fields/password.stub index 939d971..4afe172 100644 --- a/templates/scaffold/custom_fields/password.stub +++ b/templates/scaffold/custom_fields/password.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::password('$FIELD_NAME$',[$REQUIRED$$DISABLED$'autocomplete' => 'off','class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/radio.stub b/templates/scaffold/custom_fields/radio.stub index 4a6a73e..32fbd28 100644 --- a/templates/scaffold/custom_fields/radio.stub +++ b/templates/scaffold/custom_fields/radio.stub @@ -1,8 +1,8 @@ -
+
-
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/radio_group.stub b/templates/scaffold/custom_fields/radio_group.stub index 9a5123e..248223e 100644 --- a/templates/scaffold/custom_fields/radio_group.stub +++ b/templates/scaffold/custom_fields/radio_group.stub @@ -1,5 +1,5 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} $RADIO_BUTTONS$ -
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/select.stub b/templates/scaffold/custom_fields/select.stub index 6767396..a85e8a9 100644 --- a/templates/scaffold/custom_fields/select.stub +++ b/templates/scaffold/custom_fields/select.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::select('$FIELD_NAME$', $INPUT_ARR$, $FIELD_VALUE$, ['class' => 'select2 form-control']) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
diff --git a/templates/scaffold/custom_fields/selects.stub b/templates/scaffold/custom_fields/selects.stub index aa4bbcd..316c627 100644 --- a/templates/scaffold/custom_fields/selects.stub +++ b/templates/scaffold/custom_fields/selects.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$[]', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$[]', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::select('$FIELD_NAME$[]', $INPUT_ARR$, $INPUT_ARR_SELECTED$, ['class' => 'select2 form-control' , 'multiple'=>'multiple']) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
diff --git a/templates/scaffold/custom_fields/text.stub b/templates/scaffold/custom_fields/text.stub index 1ba5f6c..74d503b 100644 --- a/templates/scaffold/custom_fields/text.stub +++ b/templates/scaffold/custom_fields/text.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::text('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/custom_fields/textarea.stub b/templates/scaffold/custom_fields/textarea.stub index a6199b0..b78ec73 100644 --- a/templates/scaffold/custom_fields/textarea.stub +++ b/templates/scaffold/custom_fields/textarea.stub @@ -1,9 +1,9 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::textarea('$FIELD_NAME$', $FIELD_VALUE$, [$REQUIRED$$DISABLED$'class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/boolean.stub b/templates/scaffold/fields/boolean.stub index f2f5d9a..03fbba8 100644 --- a/templates/scaffold/fields/boolean.stub +++ b/templates/scaffold/fields/boolean.stub @@ -1,10 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
- -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} {!! Form::hidden('$FIELD_NAME$', 0, ['id'=>"hidden_$FIELD_NAME$"]) !!} +
+ {!! Form::checkbox('$FIELD_NAME$', 1, null) !!} +
diff --git a/templates/scaffold/fields/checkbox.stub b/templates/scaffold/fields/checkbox.stub index 9f876f5..99ececc 100644 --- a/templates/scaffold/fields/checkbox.stub +++ b/templates/scaffold/fields/checkbox.stub @@ -1,10 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
- -
-
\ No newline at end of file +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} {!! Form::hidden('$FIELD_NAME$', 0, ['id'=>"hidden_$FIELD_NAME$"]) !!} +
+ {!! Form::checkbox('$FIELD_NAME$', 1, null) !!} +
+
diff --git a/templates/scaffold/fields/checkbox_group.stub b/templates/scaffold/fields/checkbox_group.stub index 4c7590a..88979ad 100644 --- a/templates/scaffold/fields/checkbox_group.stub +++ b/templates/scaffold/fields/checkbox_group.stub @@ -1,5 +1,5 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} $CHECKBOXES$ -
\ No newline at end of file +
diff --git a/templates/scaffold/fields/date.stub b/templates/scaffold/fields/date.stub index ec2135a..f43e7de 100644 --- a/templates/scaffold/fields/date.stub +++ b/templates/scaffold/fields/date.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::text('$FIELD_NAME$', null, ['class' => 'form-control datepicker','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/email.stub b/templates/scaffold/fields/email.stub index 9514dd0..32af02f 100644 --- a/templates/scaffold/fields/email.stub +++ b/templates/scaffold/fields/email.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::email('$FIELD_NAME$', null, ['class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/file.stub b/templates/scaffold/fields/file.stub index e6ae277..d024ea8 100644 --- a/templates/scaffold/fields/file.stub +++ b/templates/scaffold/fields/file.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
@@ -54,4 +54,4 @@ dz_$RANDOM_VARIABLE$[0].mockFile = $RANDOM_VARIABLE$; dropzoneFields['$FIELD_NAME$'] = dz_$RANDOM_VARIABLE$; -@endprepend \ No newline at end of file +@endprepend diff --git a/templates/scaffold/fields/number.stub b/templates/scaffold/fields/number.stub index dc02a01..426475e 100644 --- a/templates/scaffold/fields/number.stub +++ b/templates/scaffold/fields/number.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
- {!! Form::number('$FIELD_NAME$', null, ['class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!} -
- {{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
+ {!! Form::number('$FIELD_NAME$', null, ['class' => 'form-control','step'=>'any', 'min'=>'0', 'placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!} +
+ {{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }} +
-
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/password.stub b/templates/scaffold/fields/password.stub index 467a53d..359991d 100644 --- a/templates/scaffold/fields/password.stub +++ b/templates/scaffold/fields/password.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::password('$FIELD_NAME$', ['class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/radio.stub b/templates/scaffold/fields/radio.stub index e00e8aa..8787c35 100644 --- a/templates/scaffold/fields/radio.stub +++ b/templates/scaffold/fields/radio.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!}
-
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/radio_group.stub b/templates/scaffold/fields/radio_group.stub index 9a5123e..248223e 100644 --- a/templates/scaffold/fields/radio_group.stub +++ b/templates/scaffold/fields/radio_group.stub @@ -1,5 +1,5 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} +
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} $RADIO_BUTTONS$ -
\ No newline at end of file +
diff --git a/templates/scaffold/fields/select.stub b/templates/scaffold/fields/select.stub index 47ebbd3..daa88d7 100644 --- a/templates/scaffold/fields/select.stub +++ b/templates/scaffold/fields/select.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::select('$FIELD_NAME$', $INPUT_ARR$, null, ['class' => 'select2 form-control']) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
diff --git a/templates/scaffold/fields/selects.stub b/templates/scaffold/fields/selects.stub index aa4bbcd..316c627 100644 --- a/templates/scaffold/fields/selects.stub +++ b/templates/scaffold/fields/selects.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$[]', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$[]', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"),['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::select('$FIELD_NAME$[]', $INPUT_ARR$, $INPUT_ARR_SELECTED$, ['class' => 'select2 form-control' , 'multiple'=>'multiple']) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
diff --git a/templates/scaffold/fields/text.stub b/templates/scaffold/fields/text.stub index d707698..3009eb0 100644 --- a/templates/scaffold/fields/text.stub +++ b/templates/scaffold/fields/text.stub @@ -1,10 +1,10 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::text('$FIELD_NAME$', null, ['class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder")]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/fields/textarea.stub b/templates/scaffold/fields/textarea.stub index 3ee45df..858dfc8 100644 --- a/templates/scaffold/fields/textarea.stub +++ b/templates/scaffold/fields/textarea.stub @@ -1,9 +1,9 @@ -
- {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$"), ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +
{!! Form::textarea('$FIELD_NAME$', null, ['class' => 'form-control','placeholder'=> trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_placeholder") ]) !!}
{{ trans("lang.$MODEL_NAME_SNAKE$_$FIELD_NAME$_help") }}
-
\ No newline at end of file +
diff --git a/templates/scaffold/layouts/app.stub b/templates/scaffold/layouts/app.stub index 1456913..0d90032 100644 --- a/templates/scaffold/layouts/app.stub +++ b/templates/scaffold/layouts/app.stub @@ -201,8 +201,7 @@ - - + @@ -229,4 +228,4 @@ @yield('scripts') - \ No newline at end of file + diff --git a/templates/scaffold/layouts/menu.stub b/templates/scaffold/layouts/menu.stub new file mode 100644 index 0000000..e69de29 diff --git a/templates/scaffold/views/create.stub b/templates/scaffold/views/create.stub index 29e07da..38cfbab 100644 --- a/templates/scaffold/views/create.stub +++ b/templates/scaffold/views/create.stub @@ -1,31 +1,29 @@ @extends('layouts.app') @push('css_lib') - - - - - - -{{--dropzone--}} - + + + + + @endpush @section('content')
-
-
-
-

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} {{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

-
-
- -
-
+
+
+
+

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} |{{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

+
+
+ +
+
@@ -36,40 +34,35 @@
{!! Form::open(['route' => '$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.store']) !!}
- @include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.fields') + @include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.fields')
{!! Form::close() !!} -
+
@include('layouts.media_modal') @endsection @push('scripts_lib') - - - - - - -{{--dropzone--}} - + + + -@endpush \ No newline at end of file +@endpush diff --git a/templates/scaffold/views/datatables_actions.stub b/templates/scaffold/views/datatables_actions.stub index 3e9ea78..896f83d 100644 --- a/templates/scaffold/views/datatables_actions.stub +++ b/templates/scaffold/views/datatables_actions.stub @@ -1,23 +1,11 @@
- @can('$MODEL_NAME_PLURAL_CAMEL$.show') - - - - @endcan + @can('$MODEL_NAME_PLURAL_CAMEL$.show') + + @endcan - @can('$MODEL_NAME_PLURAL_CAMEL$.edit') - - - - @endcan + @can('$MODEL_NAME_PLURAL_CAMEL$.edit') + + @endcan - @can('$MODEL_NAME_PLURAL_CAMEL$.destroy') -{!! Form::open(['route' => ['$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.destroy', $$PRIMARY_KEY_NAME$], 'method' => 'delete']) !!} - {!! Form::button('', [ - 'type' => 'submit', - 'class' => 'btn btn-link text-danger', - 'onclick' => "return confirm('Are you sure?')" - ]) !!} -{!! Form::close() !!} - @endcan + @can('$MODEL_NAME_PLURAL_CAMEL$.destroy') {!! Form::open(['route' => ['$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.destroy', $$PRIMARY_KEY_NAME$], 'method' => 'delete']) !!} {!! Form::button('', [ 'type' => 'submit', 'class' => 'btn btn-link text-danger', 'onclick' => "return confirm('Are you sure?')" ]) !!} {!! Form::close() !!} @endcan
diff --git a/templates/scaffold/views/edit.stub b/templates/scaffold/views/edit.stub index de59afd..7ff3700 100644 --- a/templates/scaffold/views/edit.stub +++ b/templates/scaffold/views/edit.stub @@ -1,31 +1,29 @@ @extends('layouts.app') @push('css_lib') - - - - - - -{{--dropzone--}} - + + + + + @endpush @section('content')
-
-
-
-

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} {{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

-
-
- -
-
+
+
+
+

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} |{{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

+
+
+ +
+
@@ -36,45 +34,40 @@
{!! Form::model($$MODEL_NAME_CAMEL$, ['route' => ['$ROUTE_NAMED_PREFIX$$MODEL_NAME_PLURAL_CAMEL$.update', $$MODEL_NAME_CAMEL$->$PRIMARY_KEY_NAME$], 'method' => 'patch']) !!}
- @include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.fields') + @include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.fields')
{!! Form::close() !!} -
+
@include('layouts.media_modal') @endsection @push('scripts_lib') - - - - - - -{{--dropzone--}} - + + + -@endpush \ No newline at end of file +@endpush diff --git a/templates/scaffold/views/fields.stub b/templates/scaffold/views/fields.stub index d23b6b7..0ef3955 100644 --- a/templates/scaffold/views/fields.stub +++ b/templates/scaffold/views/fields.stub @@ -10,7 +10,7 @@ $FIELDS$
@endif -
- - {{trans('lang.cancel')}} +
+ + {{trans('lang.cancel')}}
diff --git a/templates/scaffold/views/index.stub b/templates/scaffold/views/index.stub index 86c3616..b09bb78 100644 --- a/templates/scaffold/views/index.stub +++ b/templates/scaffold/views/index.stub @@ -3,20 +3,21 @@ @section('content')
-
-
-
-

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} {{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

-
-
- -
-
+
+
+
+

{{trans('lang.$MODEL_NAME_SNAKE$_plural')}} |{{trans('lang.$MODEL_NAME_SNAKE$_desc')}}

+
+
+ +
+
@@ -26,15 +27,17 @@ @include('flash::message')
-
diff --git a/templates/scaffold/views/show.stub b/templates/scaffold/views/show.stub index 10a46c7..e957182 100644 --- a/templates/scaffold/views/show.stub +++ b/templates/scaffold/views/show.stub @@ -27,7 +27,7 @@ {{trans('lang.$MODEL_NAME_SNAKE$_table')}}
@@ -36,7 +36,7 @@ @include('$VIEW_PREFIX$$MODEL_NAME_PLURAL_SNAKE$.show_fields') - diff --git a/templates/scaffold/views/show_field.stub b/templates/scaffold/views/show_field.stub index df2c607..93db569 100644 --- a/templates/scaffold/views/show_field.stub +++ b/templates/scaffold/views/show_field.stub @@ -1,7 +1,7 @@ -
- {!! Form::label('$FIELD_NAME$', '$FIELD_NAME_TITLE$:', ['class' => 'col-3 control-label text-right']) !!} -
+
+ {!! Form::label('$FIELD_NAME$', '$FIELD_NAME_TITLE$:', ['class' => 'col-md-3 control-label text-md-right mx-1']) !!} +

{!! $$MODEL_NAME_CAMEL$->$FIELD_NAME$ !!}

-
\ No newline at end of file +
diff --git a/templates/vuejs/vendor/vue-editable/vue-editable.js b/templates/vuejs/vendor/vue-editable/vue-editable.js index 842e172..9cb7c9c 100644 --- a/templates/vuejs/vendor/vue-editable/vue-editable.js +++ b/templates/vuejs/vendor/vue-editable/vue-editable.js @@ -8,7 +8,7 @@ input.focus(); var len = input.value.length; if (document.selection) { - var sel = input.createTextRange(); + var sel = input.createToptionnge(); sel.moveStart('character', len); sel.collapse(); sel.select(); @@ -25,25 +25,25 @@ target.innerHTML = value; } //input.removeEventListener("blur", null, false); - input.removeEventListener("keypress", update, false); + input.removeEventListener("keypress", update, false); }; var reinit = function() { - if (value != this.value && this.value != '') + if (value != this.value && this.value != '') target.innerHTML = value; e.stopImmediatePropagation(); e.preventDefault(); input.removeEventListener("blur", reinit, false); } - input.addEventListener("blur", update, false); + input.addEventListener("blur", update, false); input.addEventListener('keypress', function (e) { var key = e.which || e.keyCode; if (key === 13) { update(); input.removeEventListener("blur", update, false); } - }); + }); } } } @@ -58,4 +58,4 @@ window.VueEditable = VueEditable; Vue.use(VueEditable); }; -})(); \ No newline at end of file +})();