laravel-api-generator
laravel-api-generator copied to clipboard
Error when trying to generate with --search
Hi. Thanks for this nice generator.
I get this error when trying to generate with --search
FatalErrorException in cf9b4046a0ff5aa3cb467dff9252cd9f line 25: syntax error, unexpected 'class' (T_CLASS), expecting ']'
I suppose the problem is coming from the code generated in indx.blade.php
Congratulations fro the nice work.
Michel.
@iz5clj,
I got the bug and will fix it and will include it in next release. Meanwhile you can publish your custom templates and can fix it in resources/api-generator-templates/Scaffold/Views/search.blade.txt
.
You need to put comma between class="form-inline"
and id="search_form
.
I have just done a new release v1.3.3. Check and let me know if its working fine.
Still need put comma and ">" after "=" here
class="form-inline" id="search_form
The search only works if all fields are filled and using the "=" operator.
I think if you change this
if(isset($input[$attribute]))
for
if(!empty($input[$attribute]))
The search will work better.
You can try to put a option to select the operator query here
$query->where($attribute, $input[$attribute]);
Same as
$query->where($attribute, $operator, $input[$attribute]);
I hope help
In coming new version, we want to make search better with optional and simple and advanced search functionality. so placed it on hold as of now.
Hey there, the issue is in the search function in the repository. Currently it's return $query->get() but it should be return [$query->get(), $attributes];