You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
Currently Eloquent casting supports the most common types: int (integer), float (double, real), string, bool (boolean), object, array (json), collection, date, datetime (custom_datetime) and timestamp.
Although it can solve most of the problems, I believe it is feasible to implement a casting interface to expand this concept, making possible cast to anything else (since it implements a specific interface).
Something like:
interface CastingInterface {
public function setter(...); // Called before persist data.
public function getter(...); // Called before read persited data.
}
So you can implements this interface to a casting class, and handle without need implements an acessor or mutator.
@rentalhost FYI, that wasn't a call to close this issue. Just a reference to those previous discussions / PRs so it could learn from them. This is a much needed change but so far no one has come up with a mergeable solution.
Oh, sorry. Actually I close because that it have a long discussion with PR. So I need read it first to understand if I can keep it open. Thanks you for reply! :D
Currently Eloquent casting supports the most common types:
int
(integer
),float
(double
,real
),string
,bool
(boolean
),object
,array
(json
),collection
,date
,datetime
(custom_datetime
) andtimestamp
.Although it can solve most of the problems, I believe it is feasible to implement a casting
interface
to expand this concept, making possible cast to anything else (since it implements a specific interface).Something like:
So you can implements this interface to a casting class, and handle without need implements an acessor or mutator.
The use should be like:
The text was updated successfully, but these errors were encountered: