Skip to content

Commit

Permalink
mixed cu class
Browse files Browse the repository at this point in the history
  • Loading branch information
oosor committed Jul 16, 2020
1 parent 8877e88 commit a08f5a6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/Lara/Middlewares/CustomerAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ abstract class CustomerAuth
* */
protected $em;

/**
* @var string $customerClass
* */
protected static $customerClass = SharedCustomers::class;

/**
* Handle an incoming request.
*
Expand All @@ -38,6 +43,10 @@ public function handle($request, Closure $next, $guard = null)
return $next($request);
}

/**
* @param \Illuminate\Http\Request $request
* @return bool
*/
protected function load($request): bool
{
$token = $request->segment(3);
Expand All @@ -53,7 +62,7 @@ protected function load($request): bool
throw new \Exception('Not init default EntityManager');
}

$repository = $em->getRepository(SharedCustomers::class);
$repository = $em->getRepository(static::$customerClass);
/**
* @var SharedCustomers|null $model
* */
Expand All @@ -70,5 +79,10 @@ protected function load($request): bool
return false;
}

abstract protected function isAuth($request, SharedCustomers $sharedCustomers): bool;
/**
* @param \Illuminate\Http\Request $request
* @param SharedCustomers $sharedCustomers
* @return bool
*/
abstract protected function isAuth($request, $sharedCustomers): bool;
}

0 comments on commit a08f5a6

Please sign in to comment.