generated from hanzo-alpha/package-skeleton-laravel
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: New migration for Laravel Wilayah; Update: README, Model relatio…
…nships. - Added new migration file for creating laravel wilayah tables using the configuration file for table prefixing. - Updated README.md with new example usage for API configuration and response columns. - Changed the command for running the tests in README.md. - Added Laravel 9 tests to the GitHub actions workflows. - Modified models to define database relationships properly. - Improved formatting in several migration and model files. - Renamed and updated tests from ExampleTest to ModelTest.
- Loading branch information
1 parent
87e5990
commit c8259ab
Showing
21 changed files
with
542 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::create(config('wilayah.table_prefix').'cities', static function (Blueprint $table) { | ||
$table->char('city_code', 4)->primary(); | ||
$table->char('province_code', 2); | ||
$table->string('name', 255); | ||
$table->foreign('province_code') | ||
->references('province_code') | ||
->on(config('wilayah.table_prefix').'provinces') | ||
->onUpdate('cascade') | ||
->onDelete('restrict'); | ||
}); | ||
|
||
Schema::create(config('wilayah.table_prefix').'districts', static function (Blueprint $table) { | ||
$table->char('district_code', 7)->primary(); | ||
$table->char('city_code', 4); | ||
$table->string('name', 255); | ||
$table->foreign('city_code') | ||
->references('city_code') | ||
->on(config('wilayah.table_prefix').'cities') | ||
->onUpdate('cascade') | ||
->onDelete('restrict'); | ||
}); | ||
|
||
Schema::create(config('wilayah.table_prefix').'villages', static function (Blueprint $table) { | ||
$table->char('village_code', 10)->primary(); | ||
$table->char('district_code', 7); | ||
$table->string('name', 255); | ||
$table->foreign('district_code') | ||
->references('district_code') | ||
->on(config('wilayah.table_prefix').'districts') | ||
->onUpdate('cascade') | ||
->onDelete('restrict'); | ||
}); | ||
|
||
Schema::create(config('wilayah.table_prefix').'islands', static function (Blueprint $table) { | ||
$table->char('island_code', 5)->primary(); | ||
$table->char('province_code', 2); | ||
$table->char('city_code', 4); | ||
$table->string('name', 255); | ||
$table->foreign('province_code') | ||
->references('province_code') | ||
->on(config('wilayah.table_prefix').'provinces') | ||
->onUpdate('cascade') | ||
->onDelete('restrict'); | ||
$table->foreign('city_code') | ||
->references('city_code') | ||
->on(config('wilayah.table_prefix').'cities') | ||
->onUpdate('cascade') | ||
->onDelete('restrict'); | ||
}); | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"preset": "laravel", | ||
"rules": { | ||
"blank_line_before_statement": true, | ||
"concat_space": { | ||
"spacing": "one" | ||
}, | ||
"method_argument_space": true, | ||
"single_trait_insert_per_statement": true, | ||
"types_spaces": { | ||
"space": "single" | ||
} | ||
} | ||
} |
Oops, something went wrong.