Class 'Laravel\Ui\UiCommand' not found when install argon dashboard in laravel 8 - composer-php

When i trird to install argon dashboard i got the below errors when i run this command : composer require laravel-frontend-presets/argon inside my project .
Error
Class 'Laravel\Ui\UiCommand' not found
at C:\xampp\htdocs\eloquent\vendor\laravel-frontend-presets\argon\src\ArgonPresetServiceProvider.php:19
15▕ * #return void
16▕ */
17▕ public function boot()
18▕ {
➜ 19▕ UiCommand::macro('argon', function ($command) {
20▕ ArgonPreset::install();
21▕
22▕ $command->info('Argon scaffolding installed successfully.');
23▕ });
1 C:\xampp\htdocs\eloquent\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
LaravelFrontendPresets\ArgonPreset\ArgonPresetServiceProvider::boot()
2 C:\xampp\htdocs\eloquent\vendor\laravel\framework\src\Illuminate\Container\Util.php:40
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I had the same issue and i fixed it by running
composer require laravel/ui
before doing
composer dump-autoload.

Related

artisan backpack:build fails with BadMethodCallException

In a fresh Backpack installation, when I run php artisan backpack:build it fails as follows:
BadMethodCallException
Method Illuminate\Support\Stringable::value does not exist.
at vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:113
109▕ */
110▕ public function __call($method, $parameters)
111▕ {
112▕ if (! static::hasMacro($method)) {
➜ 113▕ throw new BadMethodCallException(sprintf(
114▕ 'Method %s::%s does not exist.', static::class, $method
115▕ ));
116▕ }
117▕
• Bad Method Call: Did you mean Illuminate\Support\Stringable::headline() ?
+16 vendor frames
17 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
I'm running php 7.3.33 and laravel 8.83.27 and backpack/crud: 5.4.16 and backpack/generators: v3.3.13
UPDATE 2/15/23: I've updated the server to php 7.4.33, but the problem is unchanged.
Is this a bug, or have I done something wrong?

Please provide a valid cache path ERROR. Even if there's a storage(cache,sessions,views) folder

Why does my "composer install/update" keeps giving me this error? I also cant run some php artisan command because it will give me the same error
I already created a storage folder with cache, sessions, and views inside it but its still invalid path.
I also checked my view.php and its pointing also here
view.php
I also working on windows
Error code:
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
InvalidArgumentException : Please provide a valid cache path.
at C:\Users\SDG\myproject\vendor\laravel\framework\src\Illuminate\View\Compilers\Compiler.php:36
32| */
33| public function __construct(Filesystem $files, $cachePath)
34| {
35| if (! $cachePath) {
> 36| throw new InvalidArgumentException('Please provide a valid cache path.');
37| }
38|
39| $this->files = $files;
40| $this->cachePath = $cachePath;
Exception trace:
1 Illuminate\View\Compilers\Compiler::__construct(Object(Illuminate\Filesystem\Filesystem))
C:\Users\SDG\myproject\vendor\laravel\framework\src\Illuminate\View\ViewServiceProvider.php:92
2 Illuminate\View\ViewServiceProvider::Illuminate\View\{closure}(Object(Illuminate\Foundation\Application), [])
C:\Users\SDG\myproject\vendor\laravel\framework\src\Illuminate\Container\Container.php:799
Please use the argument -v to see more details.
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
I solved this by changing the STORAGE_PATH in my .env or just comment out the line

Call to undefined method Vender\Package\Auth::extend() in package

I'm trying to create an authentication package (module) using jwt-auth that can be reused across all of my applications. But I receive errors.
Framework Laravel
Framework version 8.46.0
jwt-auth version ^1.0.0-beta.3#dev
PHP version 7.4.20
Steps to reproduce
Create a fresh laravel project
Create a fresh package inside it
Add "tymon/jwt-auth": "^1.0.0-beta.3#dev", as requirement to the composer.json of the package
Implement JWTSubject in your User model
Try to run any artisan command.
I receive this error:
Error
Call to undefined method Vendor\Package\Auth::extend()
at vendor/tymon/jwt-auth/src/Providers/AbstractServiceProvider.php:98
94▕ * #return void
95▕ */
96▕ protected function extendAuthGuard()
97▕ {
➜ 98▕ $this->app['auth']->extend('jwt', function ($app, $name, array $config) {
99▕ $guard = new JWTGuard(
100▕ $app['tymon.jwt'],
101▕ $app['auth']->createUserProvider($config['provider']),
102▕ $app['request']
+8 vendor frames
9 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}()
+5 vendor frames
15 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
My package name is also Auth. I'm stuck at solving this problem. Any help?

How to Install Swagger-UI to Laravel 6 API for doumentation?

Installing Swagger for the First Time in laravel 6. https://github.com/DarkaOnLine/L5-Swagger.
composer require "darkaonline/l5-swagger"
php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider"
On generating command
php artisan l5-swagger:generate
Getting Error like:
php artisan l5-swagger:generate
Regenerating docs
ErrorException : Required #OA\Info() not found
at D:\XMAPP\htdocs\minidmsapi\vendor\zircote\swagger-php\src\Logger.php:39
35| $this->log = function ($entry, $type) {
36| if ($entry instanceof Exception) {
37| $entry = $entry->getMessage();
38| }
> 39| trigger_error($entry, $type);
40| };
41| }
42|
43| /**
Exception trace:
1 trigger_error("Required #OA\Info() not found")
D:\XMAPP\htdocs\minidmsapi\vendor\zircote\swagger-php\src\Logger.php:39
2 OpenApi\Logger::OpenApi\{closure}("Required #OA\Info() not found")
D:\XMAPP\htdocs\minidmsapi\vendor\zircote\swagger-php\src\Logger.php:71
Please use the argument -v to see more details.
please Help me for generating swagger documentation
Required #OA\Info() is required to initialize your swagger documentation and then use proper annotation to parse. Annotations are only parsed inside /** DocBlocks. Here you go for initial annotations swagger-php#usage

JWTGenerateCommand::handle() does not exist

I am using Laravel 5.4 and JWT Auth Library for user authentication in API development. After installation while i am running php artisan jwt:generate then it throws me error of
Method Tymon\JWTAuth\Commands\JWTGenerateCommand::handle() does not exist
Any idea what i am missing ?
This error generally display when you install jwt package in laravel 5.5 version. then after you set service providers and run following command.
php artisan jwt:generate
then you seen this error message in terminal.
how to resolve it? simple follow this step
Step - 1 Re-install package
composer require tymon/jwt-auth:dev-develop --prefer-source
or the following is a new release package use laravel 6.X
composer require tymon/jwt-auth:1.0.*
in this developement version this errors fixed.
Step - 2 Set Service Provider
'providers' => [
....
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class to
Tymon\JWTAuth\Providers\LaravelServiceProvider::class
],
Step - 3 Generate key
php artisan jwt:secret
i found this solution from here https://laravelcode.com/post/method-tymonjwtauthcommandsjwtgeneratecommandhandle-does-not-exist
Go to JWTGenerateCommand.php file located in vendor/tymon/src/Commands and paste this method
public function handle() { $this->fire(); }
It's never a great idea to change anything in the vendor folder but the there's two ways to deal with this ...
Generate a random string yourself and just change the value in the JWT config file.
Go to Tymon\JWTAuth\Commands\JWTGenerateCommand and change the fire method to handle.
go to given file path
vendor/tymon/jwt-auth/src/Commands/JWTGenerateCommand.php
change function name
public function fire() to public function handle()
run command:
php artisan jwt:generate
I'm publishing this answer because I have crash in this error more than one time.
The only solution I found that it works with Laravel 5.6 is the following:
Add "tymon/jwt-auth": "1.0.0-rc.1" to composer.json and run composer update
Open config/app.php and add the following:
config/app.php:
'providers' => [
/*
* JWT Service Provider...
*/
Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
],
'aliases' => [
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
],
Execute:
php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
Finally, execute: php artisan jwt:secret
After all that, when I hit my endpoint for login I got the following exception:
Class Tymon\JWTAuth\Providers\JWT\NamshiAdapter does not exist
This was fixed by:
Open config/jwt.php and change the following:
config/jwt.php:
'jwt' => Tymon\JWTAuth\Providers\JWT\Namshi::class,
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
Finally, note that in order to work your User model should be defined as follows:
class User extends Authenticatable implements JWTSubject
{
...
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
...
}
I can advise one solution. Go to JWTGenerateCommand.php file located in vendor/tymon/src/Commands and paste this part of code public function handle() { $this->fire(); }
I know this is not an elegant solution, but it works. I hope this might help until official fix arrive.
see here for more info
Change fire() function to handle() in this path
vendor/tymon/jwt-auth/src/commands/JWTGenerateCommand.php
In the file path: /vendor/tymon/jwt-auth/src/Commands/JWTGenerateCommand.php
Add public function
public function handle()
{
$this->fire();
}

Resources