User company addded
This commit is contained in:
@@ -20,6 +20,9 @@ return new class extends Migration
|
||||
->nullable()
|
||||
->comment('types: tel, hk, hj');
|
||||
|
||||
$table->string('name')
|
||||
->index();
|
||||
|
||||
$table->string('ssb')
|
||||
->nullable()
|
||||
->comment('Şahsy salgyt belgisi');
|
||||
@@ -30,6 +33,8 @@ return new class extends Migration
|
||||
$table->foreignId('bank_id')->nullable()->constrained('banks')->nullOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
|
||||
$table->boolean('default')->default(false);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,8 +7,32 @@ use App\Modules\Bank\Models\Bank;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id [primary,unique]
|
||||
* @property \App\Modules\UserCompany\Types\CompanyType $company_type
|
||||
* @property string $name
|
||||
* @property string $ssb [unique]
|
||||
* @property string $hb [unique]
|
||||
* @property bool $default [default: false]
|
||||
* @property int $user_id
|
||||
* @property int $bank_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
*/
|
||||
class UserCompany extends Model
|
||||
{
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'default' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* User
|
||||
*
|
||||
|
||||
@@ -31,6 +31,11 @@ enum CompanyType: string
|
||||
];
|
||||
}
|
||||
|
||||
public static function option(?string $key = ''): string
|
||||
{
|
||||
return self::options()[$key] ?? '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* Default option
|
||||
*/
|
||||
@@ -56,7 +61,7 @@ enum CompanyType: string
|
||||
/**
|
||||
* Get status
|
||||
*/
|
||||
public static function statusClass(?string $key): string
|
||||
public static function statusClass(?string $key = ''): string
|
||||
{
|
||||
return self::statusClasses()[$key] ?? 'danger';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user