Skip to content

Commit aa8ec91

Browse files
committed
Update README
1 parent df6aa58 commit aa8ec91

File tree

2 files changed

+143
-1
lines changed

2 files changed

+143
-1
lines changed

README.md

+142
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,150 @@ Run `composer require milenmk/laravel-locations` to install the package
1313

1414
Run `php artisan milenmk-locations:install` to publish the migrations and seed the database tables
1515

16+
When the command is run, the database tables for the models will be created and then they will be seeded with predefined data included in the json files.
17+
1618
## Additional Information
1719

20+
Models included in the package:
21+
22+
```
23+
class Country extends Model
24+
{
25+
protected $fillable = [
26+
'name',
27+
'code',
28+
'phone',
29+
'lat',
30+
'lng',
31+
'translations',
32+
'timezones',
33+
'numeric_code',
34+
'is_activated',
35+
'flag',
36+
'emojiU',
37+
'emoji',
38+
'wikiDataId',
39+
'currency_symbol',
40+
'currency_name',
41+
'currency',
42+
'region',
43+
'native',
44+
'tld',
45+
'capital',
46+
'nationality',
47+
'iso3',
48+
'created_at',
49+
'updated_at',
50+
];
51+
52+
protected $casts = [
53+
'translations' => 'json',
54+
'timezones' => 'json',
55+
'is_activated' => 'boolean',
56+
];
57+
58+
public function cities(): HasMany
59+
{
60+
return $this->hasMany(City::class);
61+
}
62+
}
63+
```
64+
65+
```
66+
class City extends Model
67+
{
68+
protected $fillable = [
69+
'name',
70+
'translations',
71+
'is_activated',
72+
'country_id',
73+
'lat',
74+
'lng',
75+
'created_at',
76+
'updated_at',
77+
];
78+
79+
protected $casts = [
80+
'translations' => 'json',
81+
'is_activated' => 'boolean',
82+
];
83+
84+
public function country(): BelongsTo
85+
{
86+
return $this->belongsTo(Country::class);
87+
}
88+
89+
public function areas(): HasMany
90+
{
91+
return $this->hasMany(Area::class);
92+
}
93+
}
94+
```
95+
96+
```
97+
class Area extends Model
98+
{
99+
protected $fillable = [
100+
'name',
101+
'city_id',
102+
'translations',
103+
'is_activated',
104+
'created_at',
105+
'updated_at',
106+
];
107+
108+
protected $casts = [
109+
'translations' => 'json',
110+
'is_activated' => 'boolean',
111+
];
112+
113+
public function city(): BelongsTo
114+
{
115+
return $this->belongsTo(City::class);
116+
}
117+
}
118+
```
119+
120+
```
121+
class Currency extends Model
122+
{
123+
protected $fillable = [
124+
'translations',
125+
'exchange_rate',
126+
'symbol',
127+
'is_activated',
128+
'arabic',
129+
'name',
130+
'iso',
131+
'created_at',
132+
'updated_at',
133+
];
134+
135+
protected $casts = [
136+
'translations' => 'array',
137+
'is_activated' => 'boolean',
138+
];
139+
}
140+
```
141+
142+
```
143+
class Language extends Model
144+
{
145+
protected $fillable = [
146+
'iso',
147+
'name',
148+
'arabic',
149+
'created_at',
150+
'updated_at',
151+
];
152+
153+
protected $casts = [
154+
'translations' => 'json',
155+
'is_activated' => 'boolean',
156+
];
157+
}
158+
```
159+
18160
## DISCLAIMER
19161

20162
This package is provided ”as is”, without warranty of any kind, either express or implied, including but not limited to the warranties of merchantability, fitness for a particular

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "milenmk/laravel-locations",
33
"description": "Add Countries, Cities, Areas, Languages and Currencies models to your Laravel application",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {

0 commit comments

Comments
 (0)