Closed arianpasquali closed 5 years ago
If you don't need to print json responses (mostly for api calls) you can just use regular Controller as in any other regular laravel controller.
@arianpasquali have you run this step? http://labs.infyom.com/laravelgenerator/docs/5.6/installation#publish
And all above steps before this step?
... any progress on this issue? Just starting my first app and run into this exact same problem. Are there any workarounds for this?
i have the same problem . Changing the AppBaseController by Controller fix the issue .
Another solution : add use InfyOm\Generator\Controller\AppBaseController;
in top of the controller.
In this step, http://labs.infyom.com/laravelgenerator/docs/5.8/installation#publish, AppBaseController.php
is published. Make sure, you have run this step.
If the problem persists, report it with some more details.
Hello @mitulgolakiya I'm facing the same issue, I'd used php artisan infyom:api_scaffold $MODEL_NAME --datatables=true --fromTable --tableName=$TABLE_NAME
where $MODEL_NAME and $TABLE_NAME are properly setted. the result is:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Class 'InfyOm\Generator\Controller\AppBaseController' not found
On the controller I have:
use App\DataTables\AlergenosDataTable; use App\Http\Requests; use App\Http\Requests\CreateAlergenosRequest; use App\Http\Requests\UpdateAlergenosRequest; use App\Repositories\AlergenosRepository; use Flash; use InfyOm\Generator\Controller\AppBaseController; use Response;
I would like to know if someone has faced the same issue, and get resolved already?
I ran http://labs.infyom.com/laravelgenerator/docs/5.8/installation#publish but the problem persists.
@japc-74 did you published and customized the templates?
@mitulgolakiya I ran php artisan infyom:publish
@mitulgolakiya you mean if I made changes to the templates provided by your generator, the response is nope.
@japc-74 not sure, what laravel version you are using, but something is really wrong with your templates. Because, the line,
use InfyOm\Generator\Controller\AppBaseController;
should not come because that line is not there in the current template which is here. https://github.com/InfyOmLabs/laravel-generator/blob/develop/templates/scaffold/controller/datatable_controller.stub#L11
In my opinion, you should double check your templates.
@japc-74 I hope this will guide you instead of adding more confusion.
AppBaseController is there only to add JSON responses for APIs, so if you are not using APIs, you don't need it and you can just extend Controller.
AppBaseController should be present in your Http/Controllers directory. If your namespaces are ok, you don't need the "use" line. If you need to add it, then the "use" line should be pointing somewhere in your Http directory and not the vendor directory.
You said you have ran the publish script, did you get the files published as explained in the docs?
Let me know if you need further help.
@mitulgolakiya @dhcmega thank you both guys! The issue was because templates, I did change to CoreUI by using the BoilerPlate and works just great!
is an amazing tool, saves me a lot of time.
Did you try to publish your my artisan command php artisan infyom:publish and this php artisan vendor:publish .I try and it work fine
@alamin209 Thanks bro it's work fine now.
I'm new to laravel-generator. I created a simple project following the documentation instructions. This is my project setup with dependencies versions.
"require": { "php": ">=7.1.3", "fideloper/proxy": "~4.0", "infyomlabs/adminlte-templates": "5.6.x-dev", "infyomlabs/laravel-generator": "5.6.x-dev", "laravel/framework": "5.6.*", "laravel/tinker": "~1.0", "laravelcollective/html": "5.6.0" },
After running scaffold for a simple model I keep receiving AppBaseController' not found in the generated controller.
These are the steps to reproduce.
php artisan infyom:scaffold Project --fieldsFile=fields_projects.json
php artisan migrate
fields_projects.json looks like this.
serve the app
php artisan serve
go to http://127.0.0.1:8000/projects
get this error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Class 'App\Http\Controllers\AppBaseController' not found
I've checked previous related issues here in the repository and tried different suggestions, but none could fix it. It seems I m missing something obvious here. Maybe others might be facing the same issue.