Laravel MVC, DB::table

,

MVC in Laravel [PHP] Runnable
In Laravel MVC is easy to acomplish and feels very native.

Controller:
// get data from DemoModel.php
$data = DemoModel::getData();

Model:

class DemoModel {

static public function getData()
{
return 'Model data put me in a view please.';
}
}

Basic Join:

DB::table('users')
            ->join('contacts', 'users.id', '=', 'contacts.user_id')
            ->join('orders', 'users.id', '=', 'orders.user_id')
            ->select('users.id', 'contacts.phone', 'orders.price')
            ->get();

Blogbook : PHP | Javascript | Laravel | Corcel | CodeIgniter | VueJs | ReactJs | WordPress