Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions database/factories/PostFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Eclipse\World\Factories;

use Eclipse\World\Models\Country;
use Eclipse\World\Models\Post;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;

class PostFactory extends Factory
{
protected $model = Post::class;

public function definition(): array
{
return [
'code' => $this->faker->word(),
'name' => $this->faker->name(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),

'country_id' => Country::factory(),
];
}
}
31 changes: 31 additions & 0 deletions database/migrations/2025_07_02_122310_create_posts_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

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('world_posts', function (Blueprint $table) {
$table->id();
$table->string('country_id', 2);
$table->string('code');
$table->string('name');
$table->timestamps();
$table->softDeletes();

$table->foreign('country_id')
->references('id')
->on('world_countries')
->cascadeOnDelete()
->cascadeOnUpdate();
});
}

public function down(): void
{
Schema::dropIfExists('world_posts');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('world_posts', function (Blueprint $table) {
$table->unique(['country_id', 'code'], 'unique_country_post_code');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('world_posts', function (Blueprint $table) {
$table->dropUnique('unique_country_post_code');
});
}
};
78 changes: 78 additions & 0 deletions resources/lang/en/posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

return [
'nav_label' => 'Posts',
'breadcrumb' => 'Posts',
'plural' => 'Posts',

'table' => [
'country' => [
'label' => 'Country',
],
'code' => [
'label' => 'Code',
],
'name' => [
'label' => 'Name',
],
],

'actions' => [
'create' => [
'label' => 'New post',
'heading' => 'Create Post',
],
'edit' => [
'label' => 'Edit',
'heading' => 'Edit Post',
],
'delete' => [
'label' => 'Delete',
'heading' => 'Delete Post',
],
'restore' => [
'label' => 'Restore',
'heading' => 'Restore Post',
],
'force_delete' => [
'label' => 'Permanent delete',
'heading' => 'Permanent Deletion of Post',
'description' => 'Are you sure you want to delete the post :name? This action cannot be undone.',
],
],

'form' => [
'country_id' => [
'label' => 'Country',
],
'code' => [
'label' => 'Code',
],
'name' => [
'label' => 'Name',
],
],

'filter' => [
'country' => [
'label' => 'Country',
],
],

'validation' => [
'unique_country_code' => 'A post with this code already exists for the selected country.',
],

'import' => [
'action_label' => 'Import Posts',
'modal_heading' => 'Import Posts',
'country_label' => 'Select Country',
'country_helper' => 'Choose the country for which you want to import postal data',
'success_title' => 'Import Posts',
'success_message' => 'The import posts job has been queued for :country.',
'countries' => [
'SI' => 'Slovenia',
'HR' => 'Croatia',
],
],
];
78 changes: 78 additions & 0 deletions resources/lang/hr/posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

return [
'nav_label' => 'Pošte',
'breadcrumb' => 'Pošte',
'plural' => 'Pošte',

'table' => [
'country' => [
'label' => 'Država',
],
'code' => [
'label' => 'Šifra',
],
'name' => [
'label' => 'Ime',
],
],

'actions' => [
'create' => [
'label' => 'Nova pošta',
'heading' => 'Stvaranje pošte',
],
'edit' => [
'label' => 'Uredi',
'heading' => 'Uređivanje pošte',
],
'delete' => [
'label' => 'Izbriši',
'heading' => 'Brisanje pošte',
],
'restore' => [
'label' => 'Obnovi',
'heading' => 'Obnova pošte',
],
'force_delete' => [
'label' => 'Trajno izbriši',
'heading' => 'Trajno brisanje pošte',
'description' => 'Jeste li sigurni da želite izbrisati poštu :name? Zapis više neće biti moguće obnoviti.',
],
],

'form' => [
'country_id' => [
'label' => 'Država',
],
'code' => [
'label' => 'Šifra',
],
'name' => [
'label' => 'Ime',
],
],

'filter' => [
'country' => [
'label' => 'Država',
],
],

'validation' => [
'unique_country_code' => 'Pošta s ovom šifrom već postoji za odabranu državu.',
],

'import' => [
'action_label' => 'Uvezi pošte',
'modal_heading' => 'Uvoz pošta',
'country_label' => 'Odaberi državu',
'country_helper' => 'Odaberi državu za koju želiš uvoziti poštanske podatke',
'success_title' => 'Uvoz pošta',
'success_message' => 'Zadatak za uvoz pošta je dodan u red čekanja za :country.',
'countries' => [
'SI' => 'Slovenija',
'HR' => 'Hrvatska',
],
],
];
78 changes: 78 additions & 0 deletions resources/lang/sl/posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

return [
'nav_label' => 'Pošte',
'breadcrumb' => 'Pošte',
'plural' => 'Pošte',

'table' => [
'country' => [
'label' => 'Država',
],
'code' => [
'label' => 'Šifra',
],
'name' => [
'label' => 'Ime',
],
],

'actions' => [
'create' => [
'label' => 'Nova pošta',
'heading' => 'Ustvarjanje pošte',
],
'edit' => [
'label' => 'Uredi',
'heading' => 'Urejanje pošte',
],
'delete' => [
'label' => 'Izbriši',
'heading' => 'Brisanje pošte',
],
'restore' => [
'label' => 'Obnovi',
'heading' => 'Obnovitev pošte',
],
'force_delete' => [
'label' => 'Trajno izbriši',
'heading' => 'Trajen izbris pošte',
'description' => 'Ste prepričani, da želite izbrisati pošto :name? Zapisa ne bo možno več obnoviti.',
],
],

'form' => [
'country_id' => [
'label' => 'Država',
],
'code' => [
'label' => 'Šifra',
],
'name' => [
'label' => 'Ime',
],
],

'filter' => [
'country' => [
'label' => 'Država',
],
],

'validation' => [
'unique_country_code' => 'Pošta s to šifro že obstaja za izbrano državo.',
],

'import' => [
'action_label' => 'Uvozi pošte',
'modal_heading' => 'Uvoz pošt',
'country_label' => 'Izberi državo',
'country_helper' => 'Izberi državo, za katero želiš uvoziti poštne podatke',
'success_title' => 'Uvoz pošt',
'success_message' => 'Naloga za uvoz pošt je bila dodana v čakalno vrsto za :country.',
'countries' => [
'SI' => 'Slovenija',
'HR' => 'Hrvaška',
],
],
];
Loading