You've already forked isop-mirror
feat: implement InternshipStatus enum
This commit is contained in:
22
backend/app/Enums/InternshipStatus.php
Normal file
22
backend/app/Enums/InternshipStatus.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum InternshipStatus: string
|
||||
{
|
||||
case SUBMITTED = 'SUBMITTED';
|
||||
|
||||
case CONFIRMED_BY_COMPANY = 'CONFIRMED_BY_COMPANY';
|
||||
case CONFIRMED_BY_ADMIN = 'CONFIRMED_BY_ADMIN';
|
||||
|
||||
case DENIED_BY_COMPANY = 'DENIED_BY_COMPANY';
|
||||
case DENIED_BY_ADMIN = 'DENIED_BY_ADMIN';
|
||||
|
||||
case DEFENDED = 'DEFENDED';
|
||||
case NOT_DEFENDED = 'NOT_DEFENDED';
|
||||
|
||||
public static function all(): array
|
||||
{
|
||||
return array_map(fn($case) => $case->value, self::cases());
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,20 @@ class InternshipStatusData extends Model
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $table = 'internship_statuses';
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => '\App\Enums\InternshipStatus',
|
||||
];
|
||||
}
|
||||
|
||||
public function modifiedBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'modified_by');
|
||||
@@ -43,7 +57,7 @@ class InternshipStatusData extends Model
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'internship_id' => $this->internship_id,
|
||||
'status' => $this->status,
|
||||
'status' => $this->status->value,
|
||||
'changed' => $this->changed,
|
||||
'note' => $this->note,
|
||||
'modified_by' => $this->modifiedBy,
|
||||
|
||||
Reference in New Issue
Block a user