> For the complete documentation index, see [llms.txt](https://crudstarter.gitbook.io/crudstarter-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://crudstarter.gitbook.io/crudstarter-docs/package-usage.md).

# Package Usage

## Generating Dashboard

To generate dashboard you need to simply below command.&#x20;

{% hint style="info" %}
Please note that this is one time command, you only need to execute this command once !
{% endhint %}

```
php artisan gen:dashboard
```

<div><figure><img src="https://2199596568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEK8S3sawwZds4u2XuyZ%2Fuploads%2F7lCdQlpSMhOpqyoPADD2%2Fdashboard_page.png?alt=media&amp;token=db5e9005-e5dc-42a1-a6e2-fd0075cbd800" alt=""><figcaption><p>dashboard page</p></figcaption></figure> <figure><img src="https://2199596568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEK8S3sawwZds4u2XuyZ%2Fuploads%2FceNt7SMFdbXB0GfU4YGW%2Fregister_page.png?alt=media&amp;token=ddf50de2-db5c-4e18-a653-691ba9164b0f" alt=""><figcaption><p>register page</p></figcaption></figure> <figure><img src="https://2199596568-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmEK8S3sawwZds4u2XuyZ%2Fuploads%2FvIonvuMZf3Lu9TDTTVih%2Flogin_page.png?alt=media&amp;token=5677f4a1-02bb-4db5-9773-917161879a22" alt=""><figcaption><p>login page</p></figcaption></figure></div>

## Updating proengsoft/laravel-jsvalidation config

> Update the `config/jsvalidation.php` file in your Laravel project. Change the `'view'` option from `'jsvalidation::bootstrap'` to `'jsvalidation::bootstrap5'`

{% hint style="info" %}
This configuration change will instruct the package to use the Bootstrap 5 styling for the JavaScript validation error messages and other related UI components.
{% endhint %}

## Creating CRUD via Command

### Basic Usage

This is a small introduction of the generate crud command, to fully understand and use this command please visit the Advance usage section.

Let us create a CRUD with Blog Model with fields title (string), slug (string), description (text), image (string), status (boolean).   \
\
To generate the above Blog crud we will use format of :&#x20;

> [php artisan gen:crud Model --fields="field\_name:data\_type field\_name:data\_type"](#user-content-fn-1)[^1]

```
php artisan gen:crud Blog --fields="title:str slug:str description:text image:str status:bool"
```

### Field Data Type

some short hands for convenience are provided i.e instead of **`unsignedInteger`** we can use **`uint`** instead while defining fields

| Data type Name | Short Hand For        |
| -------------- | --------------------- |
| inc            | increments            |
| int            | integer               |
| uint           | unsignedInteger       |
| tinyint        | tinyInteger           |
| utinyint       | unsignedTinyInteger   |
| smallint       | smallInteger          |
| usmallint      | unsignedSmallInteger  |
| mediumint      | mediumInteger         |
| umediumint     | unsignedMediumInteger |
| bigint         | bigInteger            |
| ubigint        | unsignedBigInteger    |
| txt            | text                  |
| tinytext       | tinyText              |
| mediumtext     | mediumText            |
| longtext       | longText              |
| bool           | boolean               |
| fid            | foreignId             |

> **Note**: For other data types like **`date, enum, decimal, uuid`** etc can typed as it is.

### Advance Usage

{% content-ref url="/pages/DJA0sUrDhiK8r4oY90wE" %}
[Generate CRUD Command](/crudstarter-docs/generate-crud-command.md)
{% endcontent-ref %}

## Generating API Command

### Basic Usage

This is a small introduction of the generate crud command, to fully understand and use this command please visit the Advance usage section.

Let us create a API with Blog Model with fields title (string), slug (string), description (text), image (string), status (boolean).   \
\
To generate the above Blog crud we will use format of :&#x20;

> [php artisan gen:api Model --fields="field\_name:data\_type field\_name:data\_type"](#user-content-fn-1)[^1]

```
php artisan gen:api Blog --fields="title:str slug:str description:text image:str status:bool"
```

### API Options

The CRUD Generator package offers two options for generating APIs:

1. **Generate API with Model and Migration**
   * Use when you don't have an existing CRUD or model for the resource.
   * Generates the model, migration, and API routes/controllers in a single command.
2. **Generate API without Model and Migration**
   * Use when you already have an existing CRUD and model for the resource.
   * Generates only the API routes and controllers, as the model and migration already exist.

The first option is suitable for creating a new resource from scratch, while the second option allows you to add API functionality to an existing CRUD and model.

More on the API in Generate API section

{% content-ref url="/pages/Mv5mWwxRswkS1brsY89X" %}
[Generate API Command](/crudstarter-docs/generate-api-command.md)
{% endcontent-ref %}

[^1]:
