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

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

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

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.

Generating models from existing database at once

I'm trying to generate models from an existing database at once without having to do it separately for all tables. I have tried to do this with reliese/laravel. I have executed:
php artisan -v code:models
However, I'm getting the following error.
ErrorException : mkdir(): Invalid path
at C:\xampp\htdocs\schaden\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:466
462| if ($force) {
463| return #mkdir($path, $mode, $recursive);
464| }
465|
466| return mkdir($path, $mode, $recursive);
467| }
468|
469| /**
470| * Move a directory.
Exception trace:
1 mkdir("")
C:\xampp\htdocs\schaden\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:466
I'm not posting the full error stack here. Can anyone help?
Probably the best solution is using the package Eloquent Model Generator that you can find on github at https://github.com/krlove/eloquent-model-generator.
Then you can easily use, for example, php artisan krlove:generate:model User --table-name=users or php artisan krlove:generate:model MyModel --table-name=my_models and use some of the package options.

Elastic search for Laravel using Laravel Scout

I am creating demo for Elastic search for Laravel using Laravel Scout.I have used this site for refernce= https://medium.com/#samogorm/basic-search-functionality-with-elasticsearch-laravel-scout-6ac182c99cbf. I have install
ElasticSearch , Java version to machine and follow step of above link, but when I run command
-php artisan scout:import “App\Account”
I got error
Symfony\Component\Debug\Exception\FatalThrowableError : Class
'app\Account' not found
at
/home/ashwinibhandare/Code/Elasticsearch/vendor/laravel/scout/src/Console/ImportCommand.php:35
31| public function handle(Dispatcher $events)
32| {
33| $class = $this->argument('model');
34|
35| $model = new $class;
36|
37| $events->listen(ModelsImported::class, function ($event) use ($class) {
38| $key = $event->models->last()->getScoutKey();
39|
Exception trace:
1
Laravel\Scout\Console\ImportCommand::handle(Object(Illuminate\Events\Dispatcher))
/home/ashwinibhandare/Code/Elasticsearch/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
2 call_user_func_array()
/home/ashwinibhandare/Code/Elasticsearch/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
Please use the argument -v to see more details.
I am not experience person, Can you please suggest me what is wrong

Resources