在我的laravel 5.7.3应用程序中,我具有用于创建用户的向导。 它有效,但是在创建用户时我附加了插件https://github.com/jrean/laravel-user-verification/
时出错我的模型app / User.php:
<?php
namespace App;
use DB;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Http\Traits\funcsTrait;
use App\library\ImagePreviewSize;
//class User extends Authenticatable
class User extends Authenticatable
{
use Notifiable;
use funcsTrait;
protected $table = 'users';
protected $primaryKey = 'id';
public $timestamps = false;
...
并在控件app / Http / Controllers / AccountController.php中:
public function postConfirm() // create new user with all related data
{
DB::beginTransaction();
try {
$newAccountData = Session::get($this->register_session_key);
$avatar_filename = ! empty($newAccountData['avatar_filename']) ? $newAccountData['avatar_filename'] : '';
$avatar_filename_path = ! empty($newAccountData['avatar_filename_path']) ? $newAccountData['avatar_filename_path'] : '';
$newUser = new User();
$newUser->username = $newAccountData['username'];
$newUser->email = $newAccountData['email'];
$newUser->password = $newAccountData['password'];
$newUser->first_name = $newAccountData['first_name'];
$newUser->last_name = $newAccountData['last_name'];
$newUser->phone = $newAccountData['phone'];
$newUser->website = $newAccountData['website'];
$newUser->status = 'N';
if ( ! empty($avatar_filename)) {
$newUser->avatar = $newAccountData['avatar_filename'];
}
$newUser->save();
$ret1= UserVerification::generate($newUser);
在最后一行,我得到了错误:
The model instance provided is not compliant with this package.
在上面链接的文档中,我读到: 提供的模型实例与此软件包不兼容。它必须实现可验证的界面Illuminate \ Contracts \ Auth \ Authenticatable
我尝试用以下行修改我的用户modfel:
<?php
namespace App;
use DB;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\Authenticatable;
use App\Http\Traits\funcsTrait;
use App\library\ImagePreviewSize;
class User extends Authenticatable
{
...
但是我得到了错误:
Class App\User cannot extend from interface Illuminate\Contracts\Auth\Authenticatable
为什么出错以及如何解决?
谢谢!
答案 0 :(得分:0)
您的REM In the actual script, these are parameters
SET SERVERNAME=DEVSQL001
SET CATALOGPREFIX=/SSISDB
REM Execution envrionment variables
SET DEVENV="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com"
SET ISDEPLOYMENTWIZARD="C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\ISDeploymentWizard.exe"
SET DEPLOYMENTFOLDER=%CD%.\Deployment\ISPACs\Staging
REM Build command
%DEVENV% KinnserBI.sln /Build "Staging"
REM Loop to deploy all ISPACs in the %DEPLOYMENTFOLDER%
CD %DEPLOYMENTFOLDER%
FOR /f %%x IN ('DIR /b /s /p *.ispac') DO (
@ECHO Deploying %%~nx to %SERVERNAME% at catalog %CATALOGPREFIX%/%%~nx
%ISDEPLOYMENTWIZARD% /Silent /ModelType:Project /SourcePath:"%%x" /DestinationServer:"%SERVERNAME%" /DestinationPath:"%CATALOGPREFIX%/%%~nx"
)
模型必须使用laravel扩展User
,默认情况下将其别名为Illuminate\Foundation\Auth\User
Authenticatable
在您的代码中,您扩展了use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
}
合同,该合同是一个PHP接口而不是一个PHP类