This commit marks the completion of Phase 3 (Integration and Improvements) and updates the project status to reflect that Phases 0 through 3 are finished. Key changes include: - **Laravel (Backend):** - Added `calling_code` column to `countries` table via new migration. - Added scripts to update calling codes for all countries. - Updated `CustomerOrderController` to include `calling_code` in country data. - Registered `api_key` middleware alias in `bootstrap/app.php`. - Improved error handling to return JSON 401 for API authentication failures. - Updated `README.md` with detailed architecture and feature descriptions. - **WordPress (Frontend/Bridge):** - Added `ifnex_wallet_charge` shortcode and AJAX handler for wallet top-ups. - Implemented auto-fill for calling codes in the order form based on selected country. - Added real-time phone number validation (digits, +, spaces only). - Added English-only validation for name, city, and address fields with UI warnings. - Updated asset enqueuing logic and versioning for CSS/JS. - **Documentation:** - Updated `IFNEX_File_Map.md`, `IFNEX_Phase0_Checklist.md`, and `IFNEX_Roadmap.md` to reflect completed phases and new features. - Updated `DEPLOYMENT.md` with new environment variables (`IFNEX_BRIDGE_API_KEY`) and required WordPress pages. - Updated project `README.md` with comprehensive feature list and system architecture.
45 lines
965 B
PHP
45 lines
965 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory; // این خط را اضافه کنید
|
|
|
|
|
|
class Country extends Model
|
|
{
|
|
|
|
|
|
use HasFactory; // این خط را اضافه کنید
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'iso_code',
|
|
'calling_code',
|
|
'export_zone_parcel',
|
|
'export_zone_doc',
|
|
'import_zone_parcel',
|
|
'import_zone_doc',
|
|
'is_active',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function fromShipments(): HasMany
|
|
{
|
|
return $this->hasMany(Shipment::class, 'from_country_id');
|
|
}
|
|
|
|
public function toShipments(): HasMany
|
|
{
|
|
return $this->hasMany(Shipment::class, 'to_country_id');
|
|
}
|
|
}
|