1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/app/Ninja/Repositories/UserRepository.php
Holger Lösken 0fbda85a59 Code Refactoring
- Removed unused uses
- Type hinting for method parameters
- Removed commented code
- Introduced comments for classes and methods
- Short array syntax
2016-07-03 16:19:22 +00:00

36 lines
825 B
PHP

<?php namespace App\Ninja\Repositories;
use DB;
use Session;
use App\Models\User;
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);
}
$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');
return $query;
}
public function save($data, $user)
{
$user->fill($data);
$user->save();
return $user;
}
}