# What Files are Inside the CRUD

If you prefer a video version:

{% embed url="<https://www.youtube.com/watch?v=9TI8kzIsZZA>" %}

Sometimes there is a need to create a new CRUD for existing panel, even after a lot of manual code changes. How to add new CRUD's code into existing system? For that, you need to understand its structure.

## Default MVC Files

When you create a CRUD, minimum of **14 new files** are generated automatically - 10 new files, and 4 old ones re-generated.

There may be more changes, depending on CRUDs fields and modules involved.

For example, if you create CRUD called **Transactions** with a few simple columns like "amount" and "transaction\_date", here's the **minimum** list of generated files:

&#x20;**\[New Model]**

* app/Transaction.php

\
&#x20;**\[New Controller]**

* app/Http/Controllers/Admin/TransactionsController.php

\
&#x20;**\[New Form Requests]**

* app/Http/Requests/MassDestroyTransactionRequest.php
* app/Http/Requests/StoreTransactionRequest.php
* app/Http/Requests/UpdateTransactionRequest.php

\
&#x20;**\[New database migration]**

* database/migrations/2019\_12\_02\_000005\_create\_transactions\_table.php

\
&#x20;**\[New Blade views]**

* resources/views/admin/transactions/create.blade.php
* resources/views/admin/transactions/edit.blade.php
* resources/views/admin/transactions/index.blade.php
* resources/views/admin/transactions/show\.blade.php

\
&#x20;**\[Changed main menu Blade view]**

* resources/views/partials/menu.blade.php

\
&#x20;**\[Changed main routes]**

* routes/web.php

\
&#x20;**\[Changed Seeds for Permissions]**

* database/seeds/PermissionsTableSeeder.php

\
&#x20;**\[Changed Translation Files for new CRUD]**

* resources/lang/en/cruds.php

## Database Migrations: Important Notice

After every new or changed CRUD, we regenerate **all** migration files to make sure they are in the right order, to avoid creating foreign keys on non-existing tables. Therefore, keep in mind that you need to double-check the migration files manually, so they still work after you merge changes.

## Additional Files - Depending on Parameters

A few more files may change with each new CRUD.

For example, if you add a **belongsTo relationship** column to other CRUD like **Users**, then additional these files are touched:

* **\[Changed]** app/User.php
* \[New] database/migrations/2019\_12\_02\_relationships\_transactions\_table.php

\
&#x20;If you ticked the checkbox to generate **API**, another list of new files:

* **\[New]** app/Http/Controllers/Api/V1/Admin/TransactionsApiController.php
* **\[New]** app/Http/Resources/Admin/TransactionResource.php
* **\[Changed]** routes/api.php

\
And the list may be bigger, with additional field types or modules.\
But, in short, these are the minimum files you need to download and copy-paste or merge into your existing project code.

## Practical Example

If you want to view content of those files, here is an [example Github Pull Request](https://github.com/LaravelDaily/QuickAdminPanel-Demo-004/pull/1/commits/9092a8066c8a35dda873e9a1e046ab89f984c431) of changed files for one new CRUD, similar to the above example.
