Need to create modules using admin panel instead of running commands - laravel-backpack

WE are building a laravel application with crud operations , as per the backpack documentation i understood how to create a module using the command
php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique,slug:string:unique"
php artisan migrate
STEP 2. create crud
php artisan backpack:crud tag
is there any way that i can create a new module with required columns through admin panel itself.

No, as far as I know, Backpack for Laravel doesn't have a way to create cruds from the panel itself. but you can call commands from your own controllers.
for example:
Artisan::call('backpack:crud tag');
take a look at the documentation here:
https://laravel.com/docs/7.x/artisan#programmatically-executing-commands

Related

Why is there no "update all plugins" in the shopware 6 backend?

I'm managing multiple shopware 6 shops with a lot of plugins installed. The backend only allows to update one plugin which is quite time consuming because the updates done in 2 steps:
the update is loaded (loader circle)
the backend is relaoded (html reload)
why is there no "update all plugins" button (like e.g. in wordpress ;-) )?
best,
Roman
I'm expecting an gui or a cli command which allows to download and update all plugins with pending updates at once.
Not excactly what you're asking for but you can pass multiple names to the cli command:
./bin/console plugin:update PluginName1 PluginName2 -n
You can also pass an empty string like this and it will update all plugins:
./bin/console plugin:update "" -n
The -n will skip the interaction to confirm the update for the given plugins.
To do that the plugins have to be present in the new version you want to have. I'd recommend to use composer to manage the plugins. Shopware has it's own registry where you can get all plugins via composer. You can find the configuration in your Shopware account. After you've bought a plugin you'll get a bearer token and can require your plugins like this:
composer require store.shopware.com/pluginname
So you will still have two steps to get the plugin and afterwards update it, but it's much more convenient than doing it in the administration.
Edit: Added the -n flag as suggested by tinect below.

Is there anyone who knows how to make a db migration files in Laminas php?

I am going to make a db migration file and migrate the file to database by using the a command.
But I can't find the command.
In Laravel we approach the goal by using this command.
php artisan make:migrate migration_client_table
Is there any similiar command that acts like the php artisan make:migrate command?
Coming from Laravel/Symfony background as well, I was asking this myself. Here are my findings:
Laminas uses laminad-db module for interactions with database. Documentation for this module however does not mention migrations at all.
Database and Models introduction to Laminas uses sql file to create a table and fill it with some original seed and does not mention altering tables at all.
Therefore I made assumption Laminas does not handle migrations at all.
Edit: According to this answer, we can use sqitch, doctrine/migrations or liquibase

Generate Form from exist Entity Symfony4

I have a table in the database which has a large number of columns. I know that EasyAdminBundle is out there and I used it in the past to create forms based on database tables. How can create this based on Entity? So that I can generate the forms automatically and no populate them manually.
You can use the Symfony Maker Bundle. With this bundle, you can generate code if you are using a version of Symfony later than 3.4. For older versions you can use Sensio Generator Bundle.
In your case, install the Maker Bundle with composer:
composer require symfony/maker-bundle --dev
Then run this command (and follow the steps) to create your form:
php bin/console make:form
To see all make commands you can use, run php bin/console list make
As symfony 4.4 you can do :
./bin/console make:entity YourFormType \\Your\\Path\\To\\Entity
From the command help :
Description:
Creates a new form class
Usage:
make:form [ <name> [<bound-class>]]

How can I make inherits of postgresql by migration in laravel 5.2?

I want yo make tables in postgresql with inherits, I foundes this http://packalyst.com/packages/package/thibaud-dauce/postgresql-schema form laravel 4.2, but it does not work whith laravel 5.2.
It shows me:
[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class ThibaudDauce\PostgresqlSchema\PostgresqlSchemaServiceProvider' not found
when i try with composer update.
Could you help me please?
You can pull in this package https://packagist.org/packages/rishi-ramawat/laravel-postgresql-inherit via composer like this for using it with Laravel 5.2.* & 5.3.* :
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.1.0"
This is a package which I maintain and it currently supports Laravel 5.2.*, 5.3.* & 5.4.*
For Laravel 5.4.* you would have to do:
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.2"
Please read the README of this package to find out more about the complete installation procedure.
You may run it:
DB::statement("ALTER TABLE capitals INHERIT cities;");

laravel 5 ide autocompletion

I want to switch to laravel 5, but have some trouble with ide - autocompletion. I'm using phpstorm.
In google, the answers always end up with suggesting to use https://github.com/barryvdh/laravel-ide-helper . But it seems like it is broken for Laravel 5.
The steps I am doing are:
Install Laravel 5
composer create-project laravel/laravel
Require ide-helper
composer require barryvdh/laravel-ide-helper
Added 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
....
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
Trying to generate the helper file
artisan ide-helper:generate
But it always breaks with following error:
exception 'InvalidArgumentException' with message 'There are no commands defined in the "ide-helper" namespace.' in C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php:501
0 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(535): Symfony\Component\Console\Application->findNamespace('ide-helper')
1 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console
\Application.php(192): Symfony\Component\Console\Application->find('ide-helper:gene...')
2 C:\xampp\htdocs\test\vendor\symfony\console\Symfony\Component\Console\Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Outpu
t\ConsoleOutput))
3 C:\xampp\htdocs\test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(91): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Out
put\ConsoleOutput))
4 C:\xampp\htdocs\test\artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
5 {main}
Maybe someone had the same issue and can help me.
I'm open for different solutions for autocompletion other than barryvdh's ide-helper.
I had the same problem and this fixed it:
Before you run php artisan ide-helper:generate command, make sure to php artisan clear-compiled and php artisan optimize as it's noted here. If this didn't fixed your problem, take a look at this and clean out PhpStorm cache by choosing this:
File | Invalidate Caches/Restart
After auto restarting, PhpStorm will index again and everything should work fine.
Sorry for my bad english.
Edited: After these steps import your Facades like this use Illuminate\Support\Facades\Auth link them inside your _ide_helper.php file like use Auth.
I ran into the same problem. These are the steps I took to fix it:
I double-checked that 'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider' was correctly added to the providers array in config/app.php.
I executed artisan clear-compiled. Had no effect
Executing php artisan config:clear fixed the problem.
This error occur when the package ServiceProvider isn't loaded.
If you have multiple config file (like for different environment), you must ensure that the service provider is well set in all the environment you which to use the package.
config/
local/
app.php
app.php
to verify if the service provider is correctly set to your application you can dump the app config:
dd(\Config::get('app.providers'));
Try this:
php artisan ide-helper:generate
Here is an updated gist as of this month. I have tested this and it works in PHPStorm.
Also you don't have to install this through composer. Copy the gist and save it in your root folder as _ide_helper.php.