App\Ninja\Repositories\TokenRepository::find PHP Method

find() public method

public find ( $userId )
    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');
    }

Usage Example

 /**
  * @param $userId
  * @return \Illuminate\Http\JsonResponse
  */
 public function getDatatable($userId)
 {
     $datatable = new TokenDatatable(false);
     $query = $this->tokenRepo->find($userId);
     return $this->datatableService->createDatatable($datatable, $query);
 }
TokenRepository