PHP Classes

File: readme.md

Recommend this page to a friend!
  Classes of aidid alam  >  Codeigniter Eloquent ORM  >  readme.md  >  Download  
File: readme.md
Role: Documentation
Content type: text/markdown
Description: Read me
Class: Codeigniter Eloquent ORM
Store CodeIgniter model objects using Eloquent ORM
Author: By
Last change:
Date: 4 months ago
Size: 1,158 bytes
 

Contents

Class file image Download

Codeigniter 3.1.0 Integrated with Illuminate Database Eloquent

Requires

php: >=5.3.7

Installation

Install the Illuminate Database package with Composer:

$ composer install

Using The Eloquent ORM

Example:

Model

<?php
use \Illuminate\Database\Eloquent\Model as Eloquent;

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

}

Controller

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]);
	}
}

Bonus

dd() Function is also implemented; Example:

class Home extends CI_Controller {

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

Documentation

Inspired From

For more information send a message to info at phpclasses dot org.