in facade.php 221, call to undefined method MySqlBuilder::defaultStringLenght() - laravel

in windows command promt full eror it gives same with some php artisan commands
C:\xampp\htdocs\jj>php artisan migrate
In Connection.php line 664:
SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal' (SQL: select * from information_schema
.tables where table_schema = juwelleryjournal and table_name = migrations)
In Connector.php line 67:
SQLSTATE[HY000] [1049] Unknown database 'juwelleryjournal'
, & php artisan make:"blabla" works well
If you encounter same error, latest windows php version could be an option for you, but it helped only my classmate, not me. The i found on already being in stack overflow (Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLength()) and didn't help either. This occurs same on laptop(win7) and desktop pc(win10). I have laravel5.5.28 on both.
Have anyone any suggestions?

Add this to your AppServiceProvider
use Illuminate\Support\Facades\Schema;
function boot()
{
Schema::defaultStringLength(191);
}

Call to undefined method Illuminate\Database\Schema\MySqlBuilder::defaultStringLenght()
=> the method name is wrong, it should be defaultStringLength

Related

symfony 5.4 and doctrine : SQLSTATE[HY000] [2019] Unknown character set

i managed to read a book on symfony 5, but i am stuck where the book begins to talk about databases. i 'v been adding this to the .env file:
DATABASE_URL="mysql://amaury:pma#localhost/paracaidismopucon?serverVersion=8&charset=utf8mb4_unicode_ci"
where paracaidismopucon is my database.
then when i type:
php bin/console doctrine:database:create -vvv
i get the following error:
In ExceptionConverter.php line 117:
An exception occurred in the driver: SQLSTATE[HY000] [2019] Unknown character set
In Exception.php line 28:
SQLSTATE[HY000] [2019] Unknown character set
In Driver.php line 28:
SQLSTATE[HY000] [2019] Unknown character set
doctrine:database:create [-s|--shard SHARD] [-c|--connection [CONNECTION]] [--if-not-exists]
i am a newbie working with symfony...
please help!
i tried to go on different websites to solve my problem
Here is the docs to configure doctrine with multiple databases. I hope that could helps you.
May be the error is caused about that "&charset=utf8mb4_unicode_ci", try to remove it.
DATABASE_URL="mysql://amaury:pma#localhost/paracaidismopucon?serverVersion=8"

can someone help me after i run the composer install

config file
enter image description here
#my appService provider
enter image description here
can someone tell me about this problem after I input composer install that problem says and now I cant migrate
[Illuminate\Database\QueryException] Database (C:\xampp\htdocs\shop2\database\db.sqlite) does not exist. (SQL: PRAGMA foreign_keys=1)
when I run php artisan migrate this problem show
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php' (SQL: select * from information_schema.tables where t
able_schema = config/database.php and table_name = migrations)
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php'
[PDOException]
SQLSTATE[HY000] [1049] Unknown database 'config/database.php'
Create an empty file with name of db.sqlite in your database folder of the app. Then, run php artisan migrate, It will be filled by the app.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uuid' in 'field list'

I use in my laravel project package to save image spatie/laravel-medialibrary, but when I want to save
image it gives me an error:
SQLSTATE[42S22]: ***Column not found: 1054 Unknown column 'uuid' in 'field list'***
I send my migration table
If anyone can help me I would be glad.
Thank you.
Based on the documentation, you should run:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="migrations"
and
php artisan migrate

Laravel ANY artisan commands return "Uncaught Error: Call to a member function report()"

I'm finding myself in a weird situation where any command I give to "artisan" it returns an error, even php artisan alone:
PHP Fatal error:
Uncaught Error: Call to a member function report() on null in /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:367
Stack trace:
#0 /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(132): Illuminate\Foundation\Console\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#1 /Users/myusername/ProjectName/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 {main} thrown in /Users/myusername/ProjectName/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php on line 367
I've not touched the vendor/laravel folder and tried updating to latest Laravel version so I suppose this error is not something I'm creating with wrong code but something other I don't really get.
It's saying the error is here:
//vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
protected function reportException(Exception $e)
{
$this->app[ExceptionHandler::class]->report($e);
}
I've tried updating Laravel, but with on luck. So I even upgraded and got the same result. What could be causing it?
Ok I found out the error is thrown when you set a __construct() inside app/Console/Kernel.php

Composer Update with Laravel 5.4 & PHP 7 "Class Name must be a valid object or a string"

So there are a few threads on this but none with exactly the same issue. Basically I upgraded to php 5.4 from 5.1 and php 7 from 5.6 and I am now getting this error message.
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
The reason this seems weird to me is the error is in the actual laravel files not in my app / something I have edited. This error happens when I run composer update or whenever I try and visit any of my webpages. Below is a full dump from composer update, any ideas?
[root#dev1 dev1]# composer update
> php artisan clear-compiled
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:96
Stack trace:
#0 [internal function]: Illuminate\Foundation\Exceptions\Handler->Illuminate\Foundation\Exceptions\{closure}(0, 'Symfony\\Compone...')
#1 /var/www/dev1/bootstrap/cache/compiled.php(6207): call_user_func(Object(Closure), 0, 'Symfony\\Compone...')
#2 /var/www/dev1/bootstrap/cache/compiled.php(12223): Illuminate\Support\Arr::first(Array, Object(Closure), NULL)
#3 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(97): Illuminate\Support\Collection->first(Object(Closure))
#4 /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(61): Illuminate\Foundation\Exceptions\Handler->shouldntReport(Object(ReflectionException))
#5 /var/www/dev1/app/Exceptions/Handler.php(33): Illuminate\Foundation\Exceptions\Handler->report(Object(ReflectionException))
#6 /var/www/dev1/vendor/laravel/fram in /var/www/dev1/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 96
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255
I've got a similar error when upgrading to Laravel 5.4. The problem is that Laravel is still loading bootstrap/cache/compiled.php (even though it says it's not used by the framework anymore). Removing the file will solve your issue.
From the docs:
If it exists, you may delete the bootstrap/cache/compiled.php file. It is no longer used by the framework.
php artisan cache:clear
php artisan clear-compiled
sudo composer dump-autoload

Resources