Skip to content

Instantly share code, notes, and snippets.

@deleugpn
Created April 8, 2018 16:38
Show Gist options
  • Save deleugpn/8fdc8ce025a02c60409b10b5955ed798 to your computer and use it in GitHub Desktop.
Save deleugpn/8fdc8ce025a02c60409b10b5955ed798 to your computer and use it in GitHub Desktop.
<?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