fix: model-generation fix 3 errors#1058
Conversation
Mosaab-Emam
left a comment
There was a problem hiding this comment.
Explaining my changes
| @if($config->options->softDelete) | ||
| {{ 'use Illuminate\Database\Eloquent\SoftDeletes;' }} | ||
| @endif |
There was a problem hiding this comment.
- Remove space right before
{{which manifests in an out-of-place space in the generated file. - Expand statement to 3 lines instead of 1 to prevent error of showing 2 statements in 1 line in the generated file.
| @if($config->options->tests or $config->options->factory) | ||
| {{ 'use Illuminate\Database\Eloquent\Factories\HasFactory;' }} | ||
| @endif |
There was a problem hiding this comment.
- Remove space right before
{{which manifests in an out-of-place space in the generated file. - Expand statement to 3 lines instead of 1 to prevent error of showing 2 statements in 1 line in the generated file.
| @if(isset($swaggerDocs)) | ||
| {!! $swaggerDocs !!} |
There was a problem hiding this comment.
Ensure the presence of a new line between docs start and the last statement above.
| @endif | ||
| @if(isset($swaggerDocs)) | ||
| {!! $swaggerDocs !!} | ||
| @else@nls(2)@endif |
There was a problem hiding this comment.
Ensure separation between class declaration and above use statements when there is no swagger docs.
| @if($config->options->softDelete) {{ infy_tab().'use SoftDeletes;' }}@endif | ||
| @if($config->options->tests or $config->options->factory){{ infy_tab().'use HasFactory;' }}@endif | ||
| public $table = '{{ $config->tableName }}'; | ||
| @if($config->options->softDelete && ($config->options->tests or $config->options->factory))@tab()use SoftDeletes, HasFactory;@nls(2) |
There was a problem hiding this comment.
Combine SoftDeletes and HasFactory in a single use statements if there are both set to true in config. and replace incorrect space with a regular tab.
| @elseif($config->options->softDelete)@tab()use SoftDeletes;@nls(2) | ||
| @elseif($config->options->tests or $config->options->factory)@tab()use HasFactory;@nls(2)@endif |
There was a problem hiding this comment.
Replace white space with a regular tab when inserting SoftDeletes or HasFactory traits.
| @if($config->options->softDelete && ($config->options->tests or $config->options->factory))@tab()use SoftDeletes, HasFactory;@nls(2) | ||
| @elseif($config->options->softDelete)@tab()use SoftDeletes;@nls(2) | ||
| @elseif($config->options->tests or $config->options->factory)@tab()use HasFactory;@nls(2)@endif | ||
| @tab()public $table = '{{ $config->tableName }}'; |
There was a problem hiding this comment.
Use @tab() instead of editor specific tab.
| @if($config->options->softDelete && ($config->options->tests or $config->options->factory))@tab()use SoftDeletes, HasFactory;@nls(2) | ||
| @elseif($config->options->softDelete)@tab()use SoftDeletes;@nls(2) | ||
| @elseif($config->options->tests or $config->options->factory)@tab()use HasFactory;@nls(2)@endif | ||
| @tab()public $table = '{{ $config->tableName }}'; |
There was a problem hiding this comment.
Use @tab() instead of editor specific tab.
Closes #1055