laravel-api-generator icon indicating copy to clipboard operation
laravel-api-generator copied to clipboard

Error when trying to generate with --search

Open iz5clj opened this issue 9 years ago • 5 comments

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 avatar May 23 '15 18:05 iz5clj

@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.

mitulgolakiya avatar May 23 '15 19:05 mitulgolakiya

I have just done a new release v1.3.3. Check and let me know if its working fine.

mitulgolakiya avatar May 23 '15 19:05 mitulgolakiya

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

MarlonEtiene avatar May 24 '15 02:05 MarlonEtiene

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.

mitulgolakiya avatar Jun 13 '15 07:06 mitulgolakiya

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];

jclyons52 avatar Jul 11 '15 00:07 jclyons52