PHP code example of chareice / laravel-real-name-verification
1. Go to this page and download the library: Download chareice/laravel-real-name-verification library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chareice / laravel-real-name-verification example snippets
class User extends Model implements RealNameVerifiableContract
{
use RealNameVerifiable;
// 传入 updateRealNameData 的参数为识别到的数据
public function updateRealNameData(RealNameData $data)
{
...
}
// 返回用户是否已经进行了实名认证
public function realNameVerified(): bool
{
...
}
}
$user = User::first();
// 验证成功,调用 $user 的 updateRealNameData 方法
// 验证失败,抛出异常
$user->verify($frontImageURL);
app(VerifyService::class)->verifyIDCard($frontImgURL, $backImgURL);
class Company extends Model implements BizLicenseVerifiableContract
{
use BizLicenseVerifiable;
public function updateBizLicenseData(BizLicenseData $data)
{
...
}
public function bizLicenseVerified(): bool
{
...
}
}
$company = Company::first();
$company->verify($licenseImgURL);
app(VerifyService::class)->verifyBizLicense($licenseImgURL);