laravel custom attributes

Solutions on MaxInterview for laravel custom attributes by the best coders in the world

showing results for - "laravel custom attributes"
Mila
12 Aug 2019
1<?php
2...
3
4class Movie extends Model{
5
6    protected $appends = ['cover'];
7
8    //define accessor
9    public function getCoverAttribute()
10    {
11        return json_decode($this->InJson)->cover;
12    }
13
14