2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Repositories;
|
2015-11-05 23:37:04 +01:00
|
|
|
|
|
|
|
use DB;
|
|
|
|
|
|
|
|
class UserRepository extends BaseRepository
|
|
|
|
{
|
|
|
|
public function getClassName()
|
|
|
|
{
|
|
|
|
return 'App\Models\User';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function find($accountId)
|
|
|
|
{
|
|
|
|
$query = DB::table('users')
|
|
|
|
->where('users.account_id', '=', $accountId);
|
|
|
|
|
2016-11-18 14:31:43 +01:00
|
|
|
$this->applyFilters($query, ENTITY_USER);
|
2015-11-05 23:37:04 +01:00
|
|
|
|
2016-03-16 00:08:00 +01:00
|
|
|
$query->select('users.public_id', 'users.first_name', 'users.last_name', 'users.email', 'users.confirmed', 'users.public_id', 'users.deleted_at', 'users.is_admin', 'users.permissions');
|
2015-11-05 23:37:04 +01:00
|
|
|
|
|
|
|
return $query;
|
|
|
|
}
|
2016-02-04 21:35:28 +01:00
|
|
|
|
2016-07-21 14:35:23 +02:00
|
|
|
public function save($data, $user)
|
2016-02-04 21:35:28 +01:00
|
|
|
{
|
|
|
|
$user->fill($data);
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
return $user;
|
|
|
|
}
|
2015-11-05 23:37:04 +01:00
|
|
|
}
|