mardi 2 octobre 2018

creating difficult function php [on hold]

I have function in my laravel package which has coded below:

    public function color($color)
{
    if ($color instanceof Collection) {
        $color = $color->toArray();
    }

    return $this->options([
        'borderColor' => $color,
    ]);
}

I can use this function in my controller, for example:

$chart->dataset('price', 'line', $open)->color('red');

its gives the color to line in chart but,... I am trying to create same function for backgroundColor() as below :

  public function backgroundColor($color)
{ 

}

how can i write and is the instanceof herein



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire