2015-11-05 23:37:04 +01:00
|
|
|
<?php namespace App\Ninja\Repositories;
|
|
|
|
|
|
|
|
use DB;
|
|
|
|
use Utils;
|
|
|
|
use Session;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Ninja\Repositories\BaseRepository;
|
|
|
|
|
|
|
|
class UserRepository extends BaseRepository
|
|
|
|
{
|
|
|
|
public function getClassName()
|
|
|
|
{
|
|
|
|
return 'App\Models\User';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function find($accountId)
|
|
|
|
{
|
|
|
|
$query = DB::table('users')
|
|
|
|
->where('users.account_id', '=', $accountId);
|
|
|
|
|
|
|
|
if (!Session::get('show_trash:user')) {
|
|
|
|
$query->where('users.deleted_at', '=', null);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
public function save($data, $user)
|
|
|
|
{
|
|
|
|
$user->fill($data);
|
|
|
|
$user->save();
|
|
|
|
|
|
|
|
return $user;
|
|
|
|
}
|
2015-11-05 23:37:04 +01:00
|
|
|
}
|