RentRepository.php 1.15 KB
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/2/9
 * Time: 15:13
 */

namespace App\Repositories\Backend\Rent;

use App\Events\Backend\Access\Spot\SpotUpdated;
use App\Exceptions\GeneralException;
use App\Modules\Models\Power\Power;
use App\Modules\Repositories\Rent\BaseRentRepository;
use Illuminate\Support\Facades\DB;

class RentRepository      extends BaseRentRepository
{
    public function getForDataTable()
    {
        return $this->query()->get();
    }



    public function getinfo()
    {
       return $this->query()->select('rent.id','rent.rent_no', 'production.total as real_total','rent.pay_time','rent.rent_type' ,'production.return_time','spot.spotname','machine.mac_no','customers.phone','production.is_return', 'production.power_no')

           ->leftjoin('spot','rent.spot_id','=','spot.id')
           ->leftjoin('machine','rent.machine_id','=','machine.id')
           ->leftjoin('production','rent.id','=','production.rent_id')
           ->leftjoin('customers', 'rent.customer_id', '=', 'customers.id')
           ->whereNotNull('rent.pay_time')
           ->where('production.is_out', '=', 1)
           ->get();
    }

}