-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#452 - refactor: user profile cleaning
- Loading branch information
1 parent
d40b4b2
commit 4e85098
Showing
10 changed files
with
116 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Observers; | ||
|
||
use Laragear\CacheQuery\Facades\CacheQuery; | ||
use Toby\Models\UserHistory; | ||
|
||
class UserHistoryObserver | ||
{ | ||
public function creating(UserHistory $userHistory): void | ||
{ | ||
CacheQuery::forget("userHistories{$userHistory->user->id}"); | ||
} | ||
|
||
public function updating(UserHistory $userHistory): void | ||
{ | ||
CacheQuery::forget("userHistories{$userHistory->user->id}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/2024_07_04_130731_cleaning_fields_in_profiles_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
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::table("profiles", function (Blueprint $table): void { | ||
$table->dropColumn("last_medical_exam_date"); | ||
$table->dropColumn("next_medical_exam_date"); | ||
$table->dropColumn("last_ohs_training_date"); | ||
$table->dropColumn("next_ohs_training_date"); | ||
$table->dropColumn("employment_date"); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::table("profiles", function (Blueprint $table): void { | ||
$table->date("last_medical_exam_date")->nullable()->default(null); | ||
$table->date("next_medical_exam_date")->nullable()->default(null); | ||
$table->date("last_ohs_training_date")->nullable()->default(null); | ||
$table->date("next_ohs_training_date")->nullable()->default(null); | ||
$table->date("employment_date")->nullable(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters