https://github.com/agungsugiarto/codeigniter4-eloquent
The Illuminate Database package for CodeIgniter 4
https://github.com/agungsugiarto/codeigniter4-eloquent
codeigniter4 codeigniter4-eloquent eloquent illuminate-database orm
Last synced: 12 months ago
JSON representation
The Illuminate Database package for CodeIgniter 4
- Host: GitHub
- URL: https://github.com/agungsugiarto/codeigniter4-eloquent
- Owner: agungsugiarto
- License: mit
- Created: 2020-08-04T12:36:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T11:51:35.000Z (about 4 years ago)
- Last Synced: 2025-05-13T11:22:38.507Z (about 1 year ago)
- Topics: codeigniter4, codeigniter4-eloquent, eloquent, illuminate-database, orm
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 26
- Watchers: 2
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# The Illuminate Database package for CodeIgniter 4
[](https://packagist.org/packages/agungsugiarto/codeigniter4-eloquent)
[](https://packagist.org/packages/agungsugiarto/codeigniter4-eloquent)
[](https://packagist.org/packages/agungsugiarto/codeigniter4-eloquent)
[](https://packagist.org/packages/agungsugiarto/codeigniter4-eloquent)
## Update from v1.x to 2.x
just simple publish config eloquent with command
```php
php spark eloquent:publish
```
## Instalation
Include this package via Composer:
```console
composer require agungsugiarto/codeigniter4-eloquent
```
## Publish config
```php
php spark eloquent:publish
```
## Costuming view pagination
The default view for pagination available with preset for bootstrap4 and basic html, if you want to costumize
just copy from `\vendor\agungsugiarto\codeigniter4-eloquent\src\Views\Bootstrap4.php` and modify with your style after that put on folder App\Views. Finnaly change your config in `App\Config\Eloquent.php`
## Setup services eloquent
Open App\Controllers\BaseController.php
add `service('eloquent');` on function initController
```php
//--------------------------------------------------------------------
// Preload any models, libraries, etc, here.
//--------------------------------------------------------------------
// E.g.:
// $this->session = \Config\Services::session();
service('eloquent');
```
## Usage
Example model
```php
response->setJSON([
'data' => Authors::all(),
'sample' => DB::table('authors')->skip(1)->take(100)->get(),
]);
}
}
```
## More info usefull link docs laravel
- [Database: Getting Started](https://laravel.com/docs/7.x/database)
- [Eloquent: Getting Started](https://laravel.com/docs/7.x/eloquent)
## License
This package is free software distributed under the terms of the [MIT license](LICENSE.md).