小编bek*_*ekt的帖子

OctoberCMS如何使用插件扩展中的字段创建自定义用户注册表单

我正在尝试学习OctoberCMS,我对扩展插件的完整过程感到困惑.我根据截屏视频(https://vimeo.com/108040919)扩展了用户插件.最终,我正在寻找创建一个名为"category"的新领域,该领域将存储用户类别.在新页面上,我有以下表单,我试图用它来仅根据他们的电子邮件地址注册新用户.根据他们注册的页面填充"类别",并且应自动生成密码,以便用户在通过电子邮件激活链接确认其帐户时进行设置.我的插件名为"Profile".

我的plugin.php文件如下所示:

<?php namespace Sser\Profile;

use System\Classes\PluginBase;
use RainLab\User\Models\User as UserModel;
use RainLab\User\Controllers\Users as UsersController;
use Sser\Profile\Models\Profile as ProfileModel;
/**
 * Profile Plugin Information File
 */
class Plugin extends PluginBase
{

    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name'        => 'Profile',
            'description' => 'Handles user demographic information',
            'author'      => '',
            'icon'        => 'icon-leaf'
        ];
    }

    public function boot()
    {
        UserModel::extend(function($model){
            $model->hasOne['profile'] = ['Sser\Profile\Models\Profile'];
        });
        // $user->profile->zip

        UserModel::deleting(function($user) …
Run Code Online (Sandbox Code Playgroud)

php user-registration laravel octobercms

15
推荐指数
2
解决办法
6685
查看次数

标签 统计

laravel ×1

octobercms ×1

php ×1

user-registration ×1