PHPackages                             iam-deep/form-tool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. iam-deep/form-tool

ActiveLibrary[Admin Panels](/categories/admin)

iam-deep/form-tool
==================

A lightweight Laravel form tool to create your admin panel or web app easily!

v3.0.106(2mo ago)2461MITPHPPHP ^8.1

Since Mar 7Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/iam-deep/form-tool)[ Packagist](https://packagist.org/packages/iam-deep/form-tool)[ RSS](/packages/iam-deep-form-tool/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (147)Used By (0)

Form Tool Package for Laravel 10+
=================================

[](#form-tool-package-for-laravel-10)

[![StyleCI](https://camo.githubusercontent.com/b42d4beaf056bd51cc52d26e821acaf5f10d54b7a5ba54d22906e0dabce25459/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3531303337353830362f736869656c643f6272616e63683d6d61696e)](https://camo.githubusercontent.com/b42d4beaf056bd51cc52d26e821acaf5f10d54b7a5ba54d22906e0dabce25459/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3531303337353830362f736869656c643f6272616e63683d6d61696e) [![GitHub](https://camo.githubusercontent.com/9fa005f281f750d6ae7c82d70151121316b2b79489c9b5edd4dfb46ad7259911/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f69616d2d646565702f666f726d2d746f6f6c)](https://camo.githubusercontent.com/9fa005f281f750d6ae7c82d70151121316b2b79489c9b5edd4dfb46ad7259911/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f69616d2d646565702f666f726d2d746f6f6c)

A lightweight Laravel form tool to create your web app or admin panel easily!

Create complex CRUDs easily and save time. Create bug-free and deliver confidently.

I love examples, let's get into it directly:
--------------------------------------------

[](#i-love-examples-lets-get-into-it-directly)

```
$model = new DataModel();
$model->db('products', 'productId');

$this->crud = Doc::create($this, $model, function (BluePrint $input) {
    $input->text('productName', 'Product Name')->required();

    $input->select('categoryId', 'Category')->options('categories.categoryId.categoryName')->required();

    $input->number('price', 'Price')->required();

    $input->image('image', 'Image');

    $input->editor('description', 'Description');
});

```

#### Let me explain

[](#let-me-explain)

Let's assume we have a database with a product table named `products` and with columns `productId, productName, categoryId, price, image, description`. And we have category table named `categories` with columns `categoryId, categoryName`

First, we have created a `$model = new DataModel();` and on the 2nd line we have passed the table name and primary id of the product table. This is the simple way we tell the form tool that this is our CRUD table.

Then we create a CRUD by calling `Doc::create()` and the parameters are:

1. The Laravel's controller class as $this
2. Passing the $model we created above
3. And the last parameter is the *Closure* which will provide us with a *BluePrint* as parameter.

Now let's understand our fields inside the Closure. For that let me tell you one thing for the most methods inside closure have 1st parameter as the database column name and 2nd as an optional label of that field. So here are the input fields: 1. We have created a text field with the column `productName` and labelled as `Product Name` and applied the required validation.
2. Then a dropdown with the column `categoryId` and labelled as `Category` instructing form tool to get the options from another table `categories` and then `categoryId` &amp; `categoryName` separated by dots(.) to show as value and text of the &lt;option&gt; tag respectively i.e. &lt;option value="`categoryId`"&gt;`categoryName`&lt;/option&gt;. Finally, we have added the required validation.
3. Then we have a price field with automatic digit validation as we have specified that it's a number field and then applied the required.
4. Then we have created an image field which will automatically apply validation for the image file and upload the image under the sub-directory `public/storage/`. More on the file uploading later.
5. And at last, we have created an editor by default `CKEditor` for our description column.

---

**Full Code:**

```
