1 year ago

edited: return eloquent model with extra data

Posted 1 year ago by successdav


I have a function that generates the path to the object

public function path()
        return '/courses/' . $this->subject->slug . '/' . $this->id;

I want it so each time I fetch a course, a row should be included as 'path' => 'courses/English/3'

Is there a way to do this?

I am using vuejs to fectch the collection

Thanks for your help

Please sign in or create an account to participate in this conversation.