Created
April 8, 2018 16:38
-
-
Save deleugpn/8fdc8ce025a02c60409b10b5955ed798 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace App\Modules\Administrators\Bags; | |
use Illuminate\Support\Facades\Hash; | |
class AdministratorBag | |
{ | |
private $attributes; | |
public function __construct(array $attributes) | |
{ | |
$this->attributes = $attributes; | |
} | |
public function attributes(): array | |
{ | |
$this->hashPassword(); | |
$this->department(); | |
return $this->attributes; | |
} | |
private function hashPassword(): void | |
{ | |
$this->attributes['password'] = Hash::make($this->attributes['password']); | |
} | |
private function department(): void | |
{ | |
$this->attributes['department_id'] = $this->attributes['department']; | |
unset($this->attributes['department']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment