1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Ninja/Repositories/UserRepository.php

55 lines
1.0 KiB
PHP
Raw Normal View History

<?php
2015-11-05 23:37:04 +01:00
namespace App\Ninja\Repositories;
use App\Models\User;
2015-11-05 23:37:04 +01:00
use DB;
use Session;
/**
* Class UserRepository
*/
2015-11-05 23:37:04 +01:00
class UserRepository extends BaseRepository
{
/**
* @return string
*/
2015-11-05 23:37:04 +01:00
public function getClassName()
{
return 'App\Models\User';
}
/**
* @param $accountId
*
* @return $this
*/
2015-11-05 23:37:04 +01:00
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
/**
* @param array $data
* @param User $user
*
* @return User
*/
public function save(array $data, User $user)
2016-02-04 21:35:28 +01:00
{
$user->fill($data);
$user->save();
return $user;
}
2015-11-05 23:37:04 +01:00
}