PHPackages                             zealous-creations/tranquil-model-controller - 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. [Framework](/categories/framework)
4. /
5. zealous-creations/tranquil-model-controller

ActiveLibrary[Framework](/categories/framework)

zealous-creations/tranquil-model-controller
===========================================

description

0.10.50(6mo ago)1214MITPHP

Since Mar 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/zealouscreations/tranquil-model-controller)[ Packagist](https://packagist.org/packages/zealous-creations/tranquil-model-controller)[ RSS](/packages/zealous-creations-tranquil-model-controller/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (66)Used By (0)

Tranquil Models and Controllers
===============================

[](#tranquil-models-and-controllers)

This package contains base Laravel Eloquent models and controllers that contain all the functionality you'll need for CRUD operations. Making Laravel development a more "Tranquil" experience.

**Compatible with Laravel 10, 11, and 12**

[Full Documentation](https://tranquil-model-controller.zealouscreations.com/)

Install
-------

[](#install)

### Require it with composer

[](#require-it-with-composer)

```
composer require zealous-creations/tranquil-model-controller
```

> NOTE: If you have installed `inertiajs/inertia-laravel` lower than `v0.6` or `doctrine/dbal` lower than `v3.0`then you may need to remove them before requiring `zealous-creations/tranquil-model-controller`

```
composer remove inertiajs/inertia-laravel
composer remove doctrine/dbal
composer require zealous-creations/tranquil-model-controller
```

### Publish migrations

[](#publish-migrations)

There are 2 migrations in this package for creating a `users` table and an `attachments` table

If you want to modify these migrations be for running them, then run this artisan command:

```
php artisan vendor:publish --tag=tranquil-model-migrations
```

Usage
-----

[](#usage)

### Tranquil Controller

[](#tranquil-controller)

The Tranquil Controller takes care of all the methods of a standard Laravel controller: `index`, `create`, `show`, `edit`, `store`, and `destroy`

For any of your model controllers all you have to do is extend `TranquilController`

```
class CarController extends TranquilController {}
```

Then all you need to do is add the resource routes for the model.

```
// routes/web.php

Route::resource('cars', CarController::class);
```

Now all of the endpoints for the resource routes will automatically work - without having to add any methods to your controller.

```
GET|HEAD  cars .................. cars.index › CarController@index
POST      cars .................. cars.store › CarController@store
GET|HEAD  cars/create ......... cars.create › CarController@create
GET|HEAD  cars/{car} .............. cars.show › CarController@show
PUT|PATCH cars/{car} .......... cars.update › CarController@update
DELETE    cars/{car} ........ cars.destroy › CarController@destroy
GET|HEAD  cars/{car}/edit ......... cars.edit › CarController@edit

```

#### Show Endpoint Example

[](#show-endpoint-example)

`GET /cars/1`

```
{
  "success": true,
  "message": "",
  "car": {
    "id": 1,
    "make": "Audi",
    "model": "A3",
    "year": 2016
  }
}
```

#### Update Endpoint Example

[](#update-endpoint-example)

`PATCH /cars/1 PAYLOAD {"year": 2024}`

This will update `year` column of the `cars` record that has the id of `1` - As long as the `year` is included in the `$fillable` model parameter.

Or if you have the model extend `TranquilModel`

```
class Car extends TranquilModel {
    //...
}
```

#### Store Endpoint Example

[](#store-endpoint-example)

`POST /cars PAYLOAD {"make": "Tesla", "model": "Model S", year": 2024}`

This will create a new record in the `cars` table. You can have automatic input validation if the model extends `TranquilModel` or uses the `HasValidation` trait.

```
class Car extends Model {
    use HasValidation;
    //...
}
```

#### List Endpoint

[](#list-endpoint)

There is also a `list` route endpoint you can add for fetching a list of records for the model

```
// routes/web.php

Route::post('cars/list', [CarController::class, 'list'])->name('cars.list');
```

#### Example

[](#example)

`POST /cars/list PAYLOAD {"where": {"make": "Buick"}}`

```
{
  "success": true,
  "message": "",
  "total": 4,
  "records": [
    {
      "id": 108,
      "make": "Buick",
      "model": "Enclave",
      "year": 2016
    },
    {
      "id": 109,
      "make": "Buick",
      "model": "Encore GX",
      "year": 2016
    },
    {
      "id": 110,
      "make": "Buick",
      "model": "Envision",
      "year": 2016
    },
    {
      "id": 111,
      "make": "Buick",
      "model": "Envista",
      "year": 2016
    }
  ]
}
```

### Tranquil Inertia Controller

[](#tranquil-inertia-controller)

You can return Inertia responses for all the standard controller methods by extending the `TranquilInertiaController`

```
class CarController extends TranquilInertiaController {}
```

Now all of the endpoints will return an `Inertia` response to the corresponding component path.

```
/cars .............. resources/js/Pages/Cars/Index
/cars/create ....... resources/js/Pages/Cars/CreateEdit
/cars/{car} ........ resources/js/Pages/Cars/Show
/cars/{car}/edit ... resources/js/Pages/Cars/CreateEdit

```

### User Model

[](#user-model)

This package also comes with a `TranquilUser` model that is for the authenticated user.

You can extend this model to modify it:

```
class User extends \Tranquil\Models\TranquilUser {

    public const roleOptions = [
		[
			'handle'      => 'super',
			'name'        => 'Super User',
			'description' => 'Has full access',
		],
		[
			'handle'      => 'leader',
			'name'        => 'Leader',
			'description' => 'Has administrator access',
		],
		[
			'handle'      => 'staff',
			'name'        => 'Staff',
			'description' => 'Has basic access',
		],
	];

	//...
}
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance69

Regular maintenance activity

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Recently: every ~26 days

Total

63

Last Release

180d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/832676a0a0d6a9322ce0bee408c977baec8b6cf1e58f61b7fb994c16983f7b9d?d=identicon)[zealouscreations](/maintainers/zealouscreations)

---

Top Contributors

[![zealouscreations](https://avatars.githubusercontent.com/u/7072952?v=4)](https://github.com/zealouscreations "zealouscreations (44 commits)")[![jwilson-ind](https://avatars.githubusercontent.com/u/97469453?v=4)](https://github.com/jwilson-ind "jwilson-ind (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zealous-creations-tranquil-model-controller/health.svg)

```
[![Health](https://phpackages.com/badges/zealous-creations-tranquil-model-controller/health.svg)](https://phpackages.com/packages/zealous-creations-tranquil-model-controller)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

22.0k32.8k1](/packages/krayin-laravel-crm)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[code16/sharp

Laravel Content Management Framework

78959.5k4](/packages/code16-sharp)[laravel-enso/core

Main requirement &amp; dependency aggregator for Laravel Enso

3463.6k138](/packages/laravel-enso-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
