1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Ninja/Repositories/TokenRepository.php
2016-07-14 22:37:04 +02:00

39 lines
812 B
PHP

<?php
namespace App\Ninja\Repositories;
use DB;
use Session;
use App\Models\Token;
/**
* Class TokenRepository
*/
class TokenRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\AccountToken';
}
/**
* @param $userId
*
* @return $this
*/
public function find($userId)
{
$query = DB::table('account_tokens')
->where('account_tokens.user_id', '=', $userId);
if (!Session::get('show_trash:token')) {
$query->where('account_tokens.deleted_at', '=', null);
}
return $query->select('account_tokens.public_id', 'account_tokens.name', 'account_tokens.token', 'account_tokens.public_id', 'account_tokens.deleted_at');
}
}