Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when passing array to property with json cast #64

Closed
phiter opened this issue Dec 29, 2017 · 2 comments
Closed

Problem when passing array to property with json cast #64

phiter opened this issue Dec 29, 2017 · 2 comments

Comments

@phiter
Copy link

phiter commented Dec 29, 2017

I'm getting this error when I try to pass an array to a model property that is cast as json.

The generator made the entire class by itself, and those are the field generated stuff:

/*
* @property array $extra_fields
*/

protected $casts = [
    'extra_fields' => 'json'
];

Exception:

image

The tool created the model adding this use clause:

use Reliese\Database\Eloquent\Model as Eloquent;

When I switched it to the Illuminate class, it worked.

use Illuminate\Database\Eloquent\Model as Eloquent;

Can this be fixed or is there a way to use Illuminate classes instead of classes from the Reliese namespace?

@CristianLlanos
Copy link
Member

Sure, you can use Illuminate\Database\Eloquent\Model as the default parent class. You just need to change it in the config file (https://github.com/reliese/laravel/blob/master/config/models.php#L55)

@phiter
Copy link
Author

phiter commented Jan 2, 2018

Oh I see, I did not notice that one. Thanks for the reply. I'll update my code first thing tomorrow. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants