<?php

namespace App\Classes\General\Eloquent\Filters;

use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use App\Classes\ValueObjects\Constants\TransactionType;
use Illuminate\Database\Eloquent\Builder;

class CreditTerm implements Filter
{

    /**
     * @param Builder $builder
     * @param $value
     * @return Builder|mixed
     */
    public static function apply(Builder $builder, $value)
    {
        return $builder;

        return $builder->whereHas('packingLists.owner', function($query) use($value) {
             $query->whereHas('companyModule.connections', function($query) use($value){
                if ($value) {
                     $query->whereHas('segments', function($query) {
                         $query->where('segments.id' , 3);
                    });
                }else{
                     $query->whereDoesntHave('segments', function($query) {
                         $query->where('segments.id' , 3);
                    });
                }
            });
        });
    }

}
