Create a PowerGrid Table
You must have PowerGrid installed and properly configured before proceeding.
To create a PowerGrid table, run the following command:
php artisan powergrid:create
Now, answer the question in your screen to complete the creation process:
1. Enter the name of your PowerGrid Component.
2. Indicate if your component will use a Model or a Collection as data source.
M for Model or
C for Collection.
This example uses the Dish Model, so we typed
3. If you choose Model, enter the path to your Model.
In this example, the Dish Model is located at App\Models\Dish.
If you don't specify App\Models -powergrid will create based on default App\Models directory.
4. Use Fillable?
PowerGrid can create columns based on your Model's
Supported databases are: MySQL, Postgre and SQLite.
If desirable, type
yes to use this feature.
If you don't use the 'id' column as the primary key, you should make sure your model is
protected $primaryKey = null;
⚡ PowerGrid Table created!
PowerGrid indicates the location where your new Table component was created.
You can also see the syntax to include the Table in your page:
Powergrid can have multiple stubs, follow this step:
- Make the changes
- Rename if necessary
- Use it using
If you need to create multiple stubs, be sure to rename them before publishing.
php artisan powergrid:publish --type=stub
Create with template
--template=full location of the stub template
php artisan powergrid:create --template=stubs/table.model.stub // stubs/my-custom-table.stub