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

How to overide code to add city from external table #2

Closed
hassansaqib opened this issue Jun 8, 2016 · 1 comment
Closed

How to overide code to add city from external table #2

hassansaqib opened this issue Jun 8, 2016 · 1 comment

Comments

@hassansaqib
Copy link

Hi Alexander, I am using your package but I have a little need to override the code. I am looking to make a separate table for cities in which I will have only id and city name. I want to have only city_id in your logic. What is the best way to do it? I do not want to change in vendor folders to avoid problems in future.

I will highly appreciate your suggestions..

@AlexanderPoellmann
Copy link
Member

Mhm, well you could store the id in the city column, extend the Address model and add an attribute like so:

public function getCityAttribute
{
    return City::find($this->city)->name;
}

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