1 year ago

Convert custom non eloquent model to json

Posted 1 year ago by ronon

I have a custom model, which is not filled with data from the database.

class MyModel {
          * @var string
    protected $title;

    // Getter and setter for it

I also tried to extend it extend Model but i always get an empty response.

  0 :  [[],[],[],[]]

How can I get it to work that i can use return response()->json($data).

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