Skip to content

Instantly share code, notes, and snippets.

View mannysoft's full-sized avatar
🏠
Working from home

Manny Isles mannysoft

🏠
Working from home
View GitHub Profile
@mannysoft
mannysoft / eloquent.php
Last active December 10, 2015 09:58
Using Eloquent outside of Laravel 4. gist from https://gist.github.com/4234104
<?php
require 'vendor/autoload.php';
$resolver = new Illuminate\Database\ConnectionResolver;
$resolver->setDefaultConnection('default');
$factory = new Illuminate\Database\Connectors\ConnectionFactory;
$connection = $factory->make(array(
'host' => 'localhost',
'database' => 'database',
{
"require": {
"php": ">=5.3.0",
"illuminate/database": "dev-master"
},
"autoload": {
"classmap": [
$ composer install
/*
* --------------------------------------------------------------------
* LOAD THE COMPOSER AUTOLOAD FILE
* --------------------------------------------------------------------
*/
require 'vendor/autoload.php';
/*
* --------------------------------------------------------------------
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// connection.php
// This is the updated code for illuminate database 4.0
$CI = & get_instance();
$config = $CI->db; // Get the DB object
$pdo = new PDO('mysql:host='.$config->hostname.';dbname='.$config->database, $config->username, $config->password);
@mannysoft
mannysoft / user.php
Last active December 10, 2015 12:08
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once('connection.php');
use Illuminate\Database\Eloquent\Model as Eloquent;
class User extends Eloquent {
public $table = "users";
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Users extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('model1', 'model2');
|
*/
<?php
$orderId = '100003033';
$order = Mage::getModel('sales/order')->loadByIncrementID($orderId);
$resource = Mage::getSingleton('core/resource');
$read = $resource->getConnection('catalog_read');
$write = $resource->getConnection('core_write');
$salesFlatOrder = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
$salesFlatOrderGrid = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['views_path'] = APPPATH . 'views/blade/';
$config['cache_path'] = APPPATH . 'cache/blade/';