将format()与返回Query构建器对象一起使用

My request SQL is constructed whith query Builder

    $candidates = DB::table('candidates')
            ->select('candidates.*')
            ->distinct()
            ->join('candidate_region', 'candidates.id', '=', 'candidate_region.candidate_id')
            ->join('candidate_job', 'candidates.id', '=', 'candidate_job.candidate_id')
            ->whereIn('candidate_region.region_id', $inputs['region'])
            ->whereIn('candidate_job.job_id', $inputs['job'])
            ->where('imavailable', '1')
            ->where('dateDisponible', '<=', $inputs['availableDate'])
            // fait appel à nbSkip() pour calculer le nombre de candidat à passer
            ->skip(Search::nbSkip($_GET['page']))
            // une fois passé le nombre, on prends les 15 suivants
            ->take(15)
            ->get();

    foreach ($paginator as &$candidate) {

        // récupère la liste des jobs
        $candidate->jobs = DB::table('jobs')
                ->join('candidate_job', 'jobs.id', '=', 'candidate_job.job_id')
                ->where('candidate_id', $candidate->id)
                ->get();

        // récupère la liste des régions
        $candidate->regions = DB::table('regions')
                    ->join('candidate_region', 'regions.id', '=', 'candidate_region.region_id')
                    ->where('candidate_id', $candidate->id)
                    ->get();
    }

    // return la liste des candidats
    return $paginator;

And i would like use ->format in view candidate.blade.php

dateDisponible = public 'dateDisponible' => string '2011-11-15 00:00:00' (length=19)

<div>
    @foreach($candidates as $candidate)
        <p>
            Disponible à partir du/depuis : {{ $candidate->dateDisponible->format('d-m-Y') }}
        </p>
    @endforeach
</div>

but i return error : Call to a member function format() on a non-object

I'm not aware of any format methods in the API. You could instead use date() such as

{{ date("d-m-Y", strtotime($candidate->dateDisponible)) }}

or use PHP's DateTime class

The format() method come from Carbon class, that is implemented by default in eloquent queries. However, i'm not sure if is possible use it with Query Builder.