Customize address_google Column and save values into multiple rows in DB #273
-
Hello guys, Here is the form field I'm using in my project. so using Google Maps API and auto-filing the address. so now I would like to save these address values into multiple rows in the database. i.e. city -> city DB column, zipcode -> zipcode DB column, state -> state DB column etc.. Any inputs would be great. Thanks!
|
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 3 replies
-
Hey @sandeepchowdary7 , Personally I'd use a Laravel Mutator for that. In my Model I'd have something like: public function setAddressAttribute($value) {
$this->city = $value['city'];
$this->street = $value['street'];
// etc
} Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Hello, I was doing like this but no luck //Controller
//Model
any help why it is not working in this case? |
Beta Was this translation helpful? Give feedback.
-
woked! Thanks! |
Beta Was this translation helpful? Give feedback.
woked! Thanks!