/home/dvjjulio/softtrash/app/Camiones.php
<?php

namespace Trash;

use Illuminate\Database\Eloquent\Model;

class Camiones extends Model
{
    //
    protected $table = 'camion';
    //public $timestamps = false;
    public function getCamiones(){
    	$sql = "SELECT c.id, c.placas, c.descripcion, u.username
				FROM camion c
				LEFT JOIN user u ON u.id = c.user_id";
		$data = \DB::select( \DB::raw( $sql ) );
		if(count($data) != null)
			return $data;
		return null;
    }

    public function getCamion($id){
    	$sql = "SELECT c.id, c.placas, c.descripcion, u.id chofer_id, u.username
				FROM camion c
				LEFT JOIN user u ON u.id = c.user_id 
				WHERE c.id = $id";
		$data = \DB::select( \DB::raw( $sql ) );
		if(count($data)!=null){
            return response()->json(array('status'=>true, 'data'=>$data));
        }else{
             return response()->json(array('status'=>false));
        }
    }
}