When I try to follow the instruction here (https://github.com/beyondcode/laravel-er-diagram-generator) I get the following error.
Symfony\Component\Debug\Exception\FatalThrowableError : Argument 1 passed to BeyondCode\ErdGenerator\GenerateDiagramCommand::getAllModelsFromEachDirectory() must be of the type array, null given, called in vendor\beyondcode\laravel-er-diagram-generator\src\GenerateDiagramCommand.php on line 96
at vendor\beyondcode\laravel-er-diagram-generator\src\GenerateDiagramCommand.php:101
97|
98| return $modelsFromDirectories;
99| }
100|
101| protected function getAllModelsFromEachDirectory(array $directories): Collection
102| {
103| return collect($directories)
104| ->map(function ($directory) {
105| return $this->modelFinder->getModelsInDirectory($directory)->all();
Exception trace:
1 BeyondCode\ErdGenerator\GenerateDiagramCommand::getAllModelsFromEachDirectory()
vendor\beyondcode\laravel-er-diagram-generator\src\GenerateDiagramCommand.php:96
2 BeyondCode\ErdGenerator\GenerateDiagramCommand::getModelsThatShouldBeInspected()
vendor\beyondcode\laravel-er-diagram-generator\src\GenerateDiagramCommand.php:57
Please use the argument -v to see more details.
I've already opened an issue in the repository.
Screen capture of the error:
Posting for others that may encounter same issue.
Confirm you are using the latest version 1.4.0 of the library
Also if you're using php artisan serve try to stop the server. Run php artisan config:cache, and restart the artisan sever.
Note that the reason why you might need to run php artisan config:cache is because Laravel does cache the app's configurations. if you changed or added new configurations you might explicitly need to clear the configuration cache so that Laravel can cache the new configurations.
If no solution yet. Try this
php artisan vendor:publish --provider=BeyondCode\\ErdGenerator\\ErdGeneratorServiceProvider.
Then repeat step 2.
Related
I've installed the composer require mpociot/laravel-apidoc-generator according to what the documentation says.
Also published the config file
Now when I run the php artisan apidoc:generate command
I got the following error, have searched google but din't find anything relevant,
Argument 1 passed to Mpociot\ApiDoc\Tools\DocumentationConfig::__construct() must be of the type array, null given, called in D:\WaheedSindhani\Projects\petApp\vendor\mpociot\laravel-apidoc-generator \src\Commands\GenerateDocumentation.php on line 61
it is a config cache problem
php artisan config:clear has solved the problem'
I use PhpStorm 2018.1.4. I installed the package laravel-ide-helper. This allows PhpStorm to see model methods, but it doesn't see any chaining methods from Laravel helpers. For example, I have the following code in the controller:
return response()->file($path,['content-type' => 'application/pdf']);
PhpStorm says to me:
Method 'file' not found in \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response.
How to fix it?
UPD: Of course, after install the package, I ran thees artisan commands:
php artisan ide-helper:generate
php artisan ide-helper:meta
Installing the laravel-ide-helper alone doesn't do anything. You need to run the artisan commands to generate the files that phpstorm will use.
php artisan ide-helper:generate
and
php artisan ide-helper:meta
Will help phpStorm's auto-completion.
Update: Since these are executed, the actual problem is a laravel structure issue:
The helper file() doesn't actually exist in the ResponseFactory (response() returns result of ResponseFactory) so IDE helper can't map to it.
file() does however exist in the Facade so if you were to do:
\Response::file($path,['content-type' => 'application/pdf']) it will auto complete.
It's a work around, but unless file() gets added to the response factory at laravel's level, there's not much ide helper or phpstorm can do.
So, I have an API endpoint /api/v1/xxx that calls a single controller and method.
In the routes/api.php I have added the following logic
if (Auth::guard('api')->guest()) {
Route::post('xxx', 'API\v1\XXController#xx');
} else {
Route::post('xxx', 'API\v1\XXController#xx')->middleware('auth:api');
}
Everything works except when I run composer install, I get the following error:
a#b /var/www/html/test/app13 $ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
[LogicException]
Key path "file:///var/www/html/test/app13/storage/oauth-public.key" does not exist or is not readable
Script php artisan optimize handling the post-install-cmd event returned with error code 1
Removing the lines in routes/api.php does not output that ^ error when I run composer install.
What am I doing wrong?
Thanks for any help.
Key path "file:///var/www/html/test/app13/storage/oauth-public.key" does not exist or is not readable
This above lines says everything, you have laravel/passport installed and enabled but you forget to generate the key,
run command
php artisan passport:install
and it will work just fine.
Whenever i try to run any php artisan commands from the command line, I get the following error(s):
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","me
ssage":"Call to a member function connection() on a non-object","file":"C:\\wamp
\\www\\cms\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Mod
el.php","line":2649}}{"error":{"type":"Symfony\\Component\\Debug\\Exception\\Fat
alErrorException","message":"Call to a member function connection() on a non-obj
ect","file":"C:\\wamp\\www\\cms\\vendor\\laravel\\framework\\src\\Illuminate\\Da
tabase\\Eloquent\\Model.php","line":2649}}
I have specified the Laravel version as 4.1.* in my composer.json but since i can't run artisan, i don't know the exact version.
This problem didn't use to happen before. And the website seems to be running fine, despite of the errors occuring in php artisan. Composer commands also work fine, as far as i can tell.
Any ideas why it is happening now?
This error seems to have happened, because for the mail configuration in app/config/mail.php, I made it to retrieve the values from the database instead of specifying the configuration options directly in that file.
So, I had to check if the function for getting the value is called from the web or from the command line. If the function is called from the command line, I simply returned an empty string.
if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
return '';
}
When I install Laravel 4, I receive this error:
ErrorException
unserialize(): Error at offset 0 of 32 bytes
C:\xampp\htdocs\blog\laravel\bootstrap\compiled.php
return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv)));
If I modify return like this:
return unserialize(base64_decode($this->stripPadding($this->mcryptDecrypt($value, $iv))));
Then the error goes away. But of course every time I run composer update this change will be undone.
What could be the reason of this problem?
I appreciate any help.
Update: This only happens when I use Auth::check().
Update 2: Now it only works with base64_decode() removed. It's like if the xampp installation has become self-aware. Jesus!
Refer to this issue: laravel/framework#1526
A change in the encryption mechanism is the cause. My solution was to empty out the sessions and views that were cached in the storage folder, then run php artisan key:generate and relaunch the server. I'm not sure which part of the process fixed the issue, but I haven't seen it since.
The command > php artisan cache:clear fixed the problem for me.
I did not have to restart the server
Can you post what you're doing that causes this error? You shouldn't be modifying the core - because as you said, updates will overwrite it.
You have to set a news Key, use the following command:
php artisan key:generate
After that test again to run the Laravel Application
php artisan serve