PHP code example of agungsugiarto / codeigniter4-eloquent
1. Go to this page and download the library: Download agungsugiarto/codeigniter4-eloquent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
agungsugiarto / codeigniter4-eloquent example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Authors extends Model
{
protected $table = 'authors';
protected $primaryKey = 'id';
}
namespace App\Controllers;
use App\Models\Authors;
use Fluent\Models\DB;
class Home extends BaseController
{
public function index()
{
return $this->response->setJSON([
'data' => Authors::all(),
'sample' => DB::table('authors')->skip(1)->take(100)->get(),
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.