-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Cachet class to determine correct User model
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
namespace Cachet; | ||
|
||
use Cachet\Http\Middleware\RedirectIfAuthenticated; | ||
use Illuminate\Contracts\Auth\Authenticatable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
|
@@ -34,6 +36,18 @@ public static function user(?Request $request = null) | |
return $request->user($guard); | ||
} | ||
|
||
/** | ||
* Get the configured user model. | ||
* | ||
* @return Model<Authenticatable> | ||
*/ | ||
public static function userModel(): Model | ||
Check failure on line 44 in src/Cachet.php GitHub Actions / Static Analysis - P8.3 - L11.x - prefer-lowest
Check failure on line 44 in src/Cachet.php GitHub Actions / Static Analysis - P8.3 - L11.x - prefer-stable
Check failure on line 44 in src/Cachet.php GitHub Actions / Static Analysis - P8.2 - L11.x - prefer-lowest
Check failure on line 44 in src/Cachet.php GitHub Actions / Static Analysis - P8.2 - L11.x - prefer-stable
|
||
{ | ||
$userModel = config('cachet.user_model'); | ||
|
||
return new $userModel; | ||
} | ||
|
||
/** | ||
* Register the Cachet routes. | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters