Add countries, provinces, cities and suburbs to your laravel admin project - https://github.com/bpocallaghan/laravel-admin-starter
Add countries, provinces, cities and suburbs to your laravel admin project. This will allow you to add cities, countries, each with a google map location., (*1)
Update your project's composer.json
file., (*2)
composer require bpocallaghan/locations
Register the routes in the routes/vendor.php
file.
- Admin, (*3)
Route::group(['prefix' => 'general/locations', 'namespace' => 'Locations\Controllers\Admin'], function () { Route::resource('suburbs', 'SuburbsController'); Route::resource('cities', 'CitiesController'); Route::resource('provinces', 'ProvincesController'); Route::resource('countries', 'CountriesController'); });
php artisan locations:publish
This will copy the database/seeds
and database/migrations
to your application.
Remember to add $this->call(LocationTableSeeder::class);
in the DatabaseSeeder.php
, (*4)
php artisan locations:publish --files=all
This will copy the models, views and controllers
to their respective directories.
Please note when you execute the above command. You need to update your routes
.
- Admin, (*5)
Route::group(['prefix' => 'locations', 'namespace' => 'Locations'], function () { Route::resource('suburbs', 'SuburbsController'); Route::resource('cities', 'CitiesController'); Route::resource('provinces', 'ProvincesController'); Route::resource('countries', 'CountriesController'); });
Package is being used at Laravel Admin Starter project., (*6)