Answers for "laravel custom attributes"

PHP
0

laravel custom attributes

<?php
...

class Movie extends Model{

    protected $appends = ['cover'];

    //define accessor
    public function getCoverAttribute()
    {
        return json_decode($this->InJson)->cover;
    }
Posted by: Guest on August-26-2021

Code answers related to "laravel custom attributes"

Browse Popular Code Answers by Language