dimanche 14 octobre 2018

Call to a member function pluck() on null

i have a problem and error :

this is error:

Call to a member function pluck() on null

    protected function setCourseTime($episode)
{
    $course = $episode->course;
    $course->time = $this->getCourseTime($course->episodes->pluck('time'));
    $course->save();
}

protected function getCourseTime($times)
{
    $timestamp = Carbon::parse('00:00:00');
    foreach ($times as $t) {
        $time = strlen($t) == 5 ? strtotime('00:' . $t) : strtotime($t);
        $timestamp->addSecond($time);
    }
    return $timestamp->format('H:i:s');
}

}

Thanks for your help

Laravel version : 5.7 php version : 7.0.2



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire