<?php
namespace Trash;
use Illuminate\Database\Eloquent\Model;
class CostoReciclable extends Model
{
//
protected $table = "costo_reciclable";
public function costo_reciclable_all(){
$sql = "SELECT cr.id, r.reciclable, c.nombre_comercial, cr.mes, cr.ano, cr.pago_cliente, cr.pago_chofer
FROM costo_reciclable cr
JOIN cliente c ON c.id = cr.cliente_id AND c.status_id = 1
JOIN reciclable r ON r.id = cr.reciclable_id AND r.status_id = 1
WHERE cr.status_id = 1";
$data = \DB::select( \DB::raw( $sql ) );
if(count($data)!=null){
return $data;
}
}
public function checkCostReciclable($data){
$sql = "SELECT *
FROM costo_reciclable
WHERE reciclable_id = $data[reciclable] AND
cliente_id = $data[cliente] AND
mes = $data[month] AND
ano = $data[year]";
$data = \DB::select( \DB::raw( $sql ) );
if(count($data)!=null){
return $data;
}
}
}