artisan backpack:build fails with BadMethodCallException - laravel

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?

Related

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?

Method Illuminate\Support\Str::replace does not exist

I am using:
Laravel Version: 8.35.1
PHP Version: 7.4.9
On Tinker and Routing I use Str::replace() method as in the docs but get error:
BadMethodCallException with message Method Illuminate\Support\Str::replace does not exist.
Example 1:
root#c6dd4af63e3c:/var/www/html# php artisan tinker
Psy Shell v0.10.7 (PHP 7.4.9 — cli) by Justin Hileman
>>> Illuminate\Support\Str::replace('8.x', '9.x', 'Laravel 8.x');
BadMethodCallException with message 'Method Illuminate\Support\Str::replace does not exist.'
>>>
Example2:
Route::get('/test', function () {
return Illuminate\Support\Str::replace('8.x', '9.x', 'Laravel 8.x');
});
Why do I have this error and how to fix it?
String Replace method Illuminate\Support\Str::replace introduced in Laravel version v8.41.0
Ref:https://github.com/laravel/framework/releases/tag/v8.41.0

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

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.

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

laravel DB::connection()->getPdo()::PARAM_STR not working

The function getPdo() with PARAM_STR in laravel
DB::connection()->getPdo()::PARAM_STR
is working fine with php 7.0.0 but not working with php 5.6.16 or lesser versions. How can I get the PARAM_STR from PDO instance in laravel with php 5.6.16 or less?
I have tried
DB::connection()->getPdo()->PARAM_STR
but not working for me..
The solution which worked for me is this..
static function db ()
{
try {
$db = DB::connection()->getPdo();
}
catch (PDOException $e) {
self::fatal(
"An error occurred while connecting to the database. ".
"The error reported by the server was: ".$e->getMessage()
);
}
return $db;
}
By calling..
$db=self::db();
$db::PARAM_STR
I got it solved. All inside class & method

Resources