jeudi 6 juin 2019

Someone can explain for me this Laravel code?

I have some code like below, the thing I want to ask is with the exactly same // dd($example->count()) #10 why put dd() on each different line has different value ? What change my $example event I never reassign it ?

$example = $car->wheels()->whereBetween(
        'created_at',
        [
            $starDay->format('Y-m-d h:i:s'),
            $today->format('Y-m-d h:i:s')
        ]
    )

$total =  $example->count();

// dd($example->count()) #10

$totalSuccess = $example->where('status', 'good')->count();

// dd($example->count()) # 5

$colors = $example->select('color', DB::raw('count(*) as total'))
        ->groupBy('color')
        ->get()
        ->toArray();

// dd($example->count()) # []



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2KwAdyp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire