feat: add whatsapp_number field to suppliers, customers, users
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
de3f4ceae6
commit
92a2eb120f
6 files changed
+93
-2
No files matched your search
@@ -9,7 +9,7 @@ class Customer extends Model
|
|||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = ['name', 'contact_person', 'email', 'phone', 'address', 'tax_number', 'credit_limit', 'outstanding_balance', 'is_active'];
|
protected $fillable = ['name', 'contact_person', 'email', 'phone', 'whatsapp_number', 'address', 'tax_number', 'credit_limit', 'outstanding_balance', 'is_active'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'credit_limit' => 'decimal:2',
|
'credit_limit' => 'decimal:2',
|
||||||
@@ -17,6 +17,11 @@ class Customer extends Model
|
|||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function routeNotificationFor(string $channel, mixed $notification = null): ?string
|
||||||
|
{
|
||||||
|
return $this->whatsapp_number;
|
||||||
|
}
|
||||||
|
|
||||||
public function salesOrders()
|
public function salesOrders()
|
||||||
{
|
{
|
||||||
return $this->hasMany(SalesOrder::class);
|
return $this->hasMany(SalesOrder::class);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Supplier extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'supplier_code', 'name', 'category',
|
'supplier_code', 'name', 'category',
|
||||||
'contact_person', 'email', 'secondary_email',
|
'contact_person', 'email', 'secondary_email',
|
||||||
'phone', 'phone2', 'whatsapp',
|
'phone', 'phone2', 'whatsapp', 'whatsapp_number',
|
||||||
'address', 'website',
|
'address', 'website',
|
||||||
'tax_number', 'credit_terms', 'credit_days',
|
'tax_number', 'credit_terms', 'credit_days',
|
||||||
'is_active', 'remarks',
|
'is_active', 'remarks',
|
||||||
@@ -20,6 +20,11 @@ class Supplier extends Model
|
|||||||
|
|
||||||
protected $casts = ['is_active' => 'boolean'];
|
protected $casts = ['is_active' => 'boolean'];
|
||||||
|
|
||||||
|
public function routeNotificationFor(string $channel, mixed $notification = null): ?string
|
||||||
|
{
|
||||||
|
return $this->whatsapp_number;
|
||||||
|
}
|
||||||
|
|
||||||
public function purchaseOrders()
|
public function purchaseOrders()
|
||||||
{
|
{
|
||||||
return $this->hasMany(PurchaseOrder::class);
|
return $this->hasMany(PurchaseOrder::class);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class User extends Authenticatable
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
|
'whatsapp_number',
|
||||||
'password',
|
'password',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -40,6 +41,11 @@ class User extends Authenticatable
|
|||||||
*
|
*
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
|
public function routeNotificationFor(string $channel, mixed $notification = null): ?string
|
||||||
|
{
|
||||||
|
return $this->whatsapp_number;
|
||||||
|
}
|
||||||
|
|
||||||
protected function casts(): array
|
protected function casts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?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('customers', function (Blueprint $table) {
|
||||||
|
$table->string('whatsapp_number')->nullable()->after('phone');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('customers', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('whatsapp_number');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?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('suppliers', function (Blueprint $table) {
|
||||||
|
$table->string('whatsapp_number')->nullable()->after('phone');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('suppliers', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('whatsapp_number');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?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('users', function (Blueprint $table) {
|
||||||
|
$table->string('whatsapp_number')->nullable()->after('email');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('whatsapp_number');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in new issue
Block a user