The docs do not state what fake columns and fields are for, or show example of using them.
I also don't see the CRUD library using either of these traits in a meaningful way.
Side Note
I originally wanted a "fake field" on the create method of a crud I've created. It polls a remote resource via ajax and updates several db column fields based on the response. This field doesn't correspond to any one column, so I needed a way to create a crud field that is ignored.
Looks like an HTML crud field is the best way for this?
Hi @zschuessler ,
You can create a field that is ignored by the CRUD's store/update just like you would any other field. The only difference would be NOT to include it in the $fillable property on your model. If you're using $guarded, then it should be guarded.
Fake fields are used in a very specific fashion: they show up on the front-end, but instead of being stored in their own column, they're all bundled into an array and stored as JSON in an "extras" column. It's a handy way to add unimportant fields without creating migrations. It's mostly used in the PageManager package. Each page template can have a bunch of fields, of different types, but they're mostly just text, so it's not important for them to be in a normal form in a relational DB. You can read more about fake fields here.
Cheers!
Awesome, thank you
Most helpful comment
Hi @zschuessler ,
You can create a field that is ignored by the CRUD's store/update just like you would any other field. The only difference would be NOT to include it in the
$fillableproperty on your model. If you're using$guarded, then it should be guarded.Fake fields are used in a very specific fashion: they show up on the front-end, but instead of being stored in their own column, they're all bundled into an array and stored as JSON in an "extras" column. It's a handy way to add unimportant fields without creating migrations. It's mostly used in the PageManager package. Each page template can have a bunch of fields, of different types, but they're mostly just text, so it's not important for them to be in a normal form in a relational DB. You can read more about fake fields here.
Cheers!