PHP code example of mod-ci / with-eloquent

1. Go to this page and download the library: Download mod-ci/with-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/ */

    

mod-ci / with-eloquent example snippets



use \Illuminate\Database\Eloquent\Model as Eloquent;

class User extends Eloquent{
    protected $table = 'users';

}

defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends CI_Controller {

	public function index()
	{
		$this->load->model('user');
		$users = User::where('votes', '>', 1)->get();
		$this->load->view('home/index', ['users' => $users]);
	}
}

class Home extends CI_Controller {

	public function index()
	{
		$this->load->model('user');
		$users = User::all();
        dd($users);
	}
}