RentRepository.php
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?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();
    }
}