Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Customer extends Model
- {
- protected $table = 'customers';
- public function contracts()
- {
- return $this->hasMany('AppContract');
- }
- class Contract extends Model
- {
- public function customer()
- {
- return $this->belongsTo('AppCustomer');
- }
- }
- $customers = Customer::with(['contracts' => function($query)
- {
- $query->where('data_end','>=','2017-07-01')
- ->where('data_end','<=','2017-07-31')
- ->where('typ','=','U') ;
- }
- ])->paginate(10);
- "Customer 1"
- "Customer 2"
- "Customer 3"
- *"Contract 1"
- *"Contract 2"
- *"Contract 3"
- "Customer 4"
- *"Contract 1"
- *"Contract 2"
- *"Contract 3"
- "Customer 4"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement