edited: return eloquent model with extra data

Posted 2 months ago by successdav

edited

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.

Reply to

Use Markdown with GitHub-flavored code blocks.