Unable to generate resources using laravel-code-generator in Laravel 5.8 - laravel-code-generator

I created a fresh Laravel project v5.8. Then installed the latest version of the Laravel Code Generator (2.3) but I'm unable to generate resources. I've read your release notes for 2.3 and I'm not seeing where I'm making a mistake on the installation or the commands I keep the output below:
php artisan create:scaffold Test generates the output below:
Exception : The file
resources/laravel-code-generator/sources/tests.json was not found!
at /Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:686
682| {
683| $fileFullname = Config::getResourceFilePath($filename);
684|
685| if (!File::exists($fileFullname)) {
> 686| throw new Exception('The file ' . $fileFullname . ' was not found!');
687| }
688|
689| return File::get($fileFullname);
690| }
Exception trace:
1 CrestApps\CodeGenerator\Models\Resource::jsonFileContent("tests.json")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Models/Resource.php:549
2 CrestApps\CodeGenerator\Models\Resource::fromFile("tests.json", "CrestApps")
/Users/Sites/Laravel/lms/vendor/crestapps/laravel-code-generator/src/Commands/Framework/CreateScaffoldCommand.php:70
Please use the argument -v to see more details.
I'm getting a similar output when trying to create resources from a database table. I'm using the php artisan resource-file:from-database [model-name] command.
I read online that it may have to do with the Laravel storage folder not having the correct permissions but I've tried that and it didn't work. Cleared and config the cache, composer dump-autoload, etc... But nothing has worked.
I'm also noticing that the generator does not publish the configuration file on your sample video on your website. I have tried to publish the config file using the vendor:publish command but it generates a somewhat empty file, only has this option: 'files_upload_path' => 'uploads'. The folder for the generator located inside the resources folder does not contain a config file.

Related

Create own laravel package

I try to create own laravel package.
I created package folder in my project in root directory.
Than created simplexi/greetr/src folders in package.
I added to autoload "Simplexi\Greetr\": "package/simplexi/greetr/src" in composer.json in main project, and used command composer dump-autoload.
Than in src folder I created RiakServiceProvider, added this provider to config=>app.php to providers array.
Then in boot method I added next code:
$this->publishes([__DIR__ . '../config/myconf.php' => config_path() . '/']);
And executed next command:
php artisan vendor:publish --provider="\Simplexi\Greetr\RiakServiceProvider"
Than I got Publishing complete.
But file myconf.php didn't copy to app/config.
Also I checked file myconf.php in my package/simplexi/greetr/config folder and it exists.
Can anyone tell me what the problem might be?
publishes() expect two parameters. Try something like this:
$this->publishes([
__DIR__.'/../config/myconf.php' => config_path('myconf.php'),
], 'config');

Manually installing/integrating a composer package

I tried installing this composer module on my Laravel app https://github.com/alihesari/laravel-social-auto-posting but im facing some issues. Im avoiding composer since it requires me to update my Laravel version which will break things (im runnin under 5.1.9).
Steps that I took so far:
1) wget https://github.com/alihesari/laravel-social-auto-posting/archive/master.zip - inside htdocs directory
2) unzipped master.zip and renamed folders. Moved folders inside /vendor/ folder under this structure:
/vendor/toolkito/larasap/ - This folder contains the src subfolder as shown in the repo.
3) Added this reference in \vendor\composer\autoload_namespaces.php and in \vendor\composer\autoload_psr4.php: 'Toolkito\\Larasap' => array($vendorDir . '/toolkito/larasap/src'),
4) Configured my secret keys in the config file, for the proper social media connection
5) Added use Toolkito\Larasap\SendTo; in the main controller, as per repo's instructions
6) Added SendTo::Twitter('Hello, I\'m testing Laravel social auto posting'); to a function that I use and ended up in this error:
FatalThrowableError in HomeController.php line 47:
Fatal error: Class 'Toolkito\Larasap\SendTo' not found
I also tried use Vendor\Toolkito\Larasap\SendTo; in step 5, and ended up with the same error message.
Any suggestions please?

after Update laravel 6.2 [App\Http\Controllers\Auth\ConfirmPasswordController] does not exist

I update laravel from v 6.0 to v6.2 and after the finish, I try php artisan route:list
This error
I had the same issue, i fixed it with the following solution:
Create a empty file named "ConfirmPasswordController.php" in the folder App/Http/Controllers/Auth
Go to https://github.com/laravel/laravel/tree/master/app/Http/Controllers/Auth en open the file named "ConfirmPasswordController.php"
Copy all the file contents to your newly created file and save it.
This should fix the error.
Edit
The problem is, were updating the composer dependencies, but not the core application. But de composer dependencies expect you to update the core. They refer to files on the core application that not exists (because the application is not up-to-date).
See: How to update Laravel Application (not the composer dependencies)
This has been fixed. Just update to Laravel 6.4
Step1. Create ConfirmPasswordController.php file in app/Http/Controllers/Auth/ path.
Step2. ConfirmPasswordController.php paste this content to ConfirmPasswordController.php file.
From v6.0.0 to v6.2.0 the following addition and modifications were made.
Added app/Http/Controllers/Auth/ConfirmPasswordController.php
Modified app/Http/Controllers/Auth/ForgotPasswordController.php
Modified app/Http/Controllers/Auth/ResetPasswordController.php
Modified app/Http/Kernel.php
Modified config/auth.php
Modified resources/lang/en/validation.php
You can see the diff of v6.0.0 to v6.2.0 here.
Create ConfirmPasswordController.php manually and It's may be duplicate of - duplicate
1 ) Open file vender/laravel/framework/src/Illuminate/Routing/Router.php".
2 ) and comment these
// $this->get('password/confirm', 'Auth\ConfirmPasswordController#showConfirmForm')->name('password.confirm');
// $this->post('password/confirm', 'Auth\ConfirmPasswordController#confirm');

View [layouts.app] not found in laravel

I have created an application in laravel using appzcoder crud-generator plug-in. i have done everything accordingly but i am getting the above mentioned error. I have a folder named layouts in views folder and this folder has app.stub in it. but when i run the project it gives the following error
View [layouts.app] not found. (View:C:\wamp64\www\myProject\resources\views\admin\items\index.blade.php)
make sure you have run below code if not run it will create layout.app path
or manually create view/layout/app.php
php artisan vendor:publish --provider="Appzcoder\CrudGenerator\CrudGeneratorServiceProvider"

API Class not found using Composer

I am new to using composer, I have it installed, created composer.json file. Installed bigcommerce api using these instructions: https://github.com/bigcommerce/bigcommerce-api-php
When I try to run "use Bigcommerce\Api\Client as Bigcommerce" I am getting error class not found.
I am using localhost and my file structure is:
testsite
src-> contains all classes including Client.php
vendor -> bigcommerce -> api -> the api files,
api.php -> my test file trying to connect to api
I have not changed any composer files, I have looked into autoloading. As I said before it is first time using composer.
Please read the documentation of Composer here: https://getcomposer.org/doc/00-intro.md Pay attention to the last couple of paragraphs, "Using Composer" and "Autoloading". Did you follow the procedures in your code?

Resources