在我的数据库中,我有这个
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('username')->unique();
$table->string('admin')->nullable();
$table->string('usertype')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
以我的形式,我有这个]
<select name="usertype"> <option>Select Usertype</option> <option value="1">Landlord</option> <option value="2">Agent</option> <option value="3">Tenant</option> </select>
用户可以选择自己的用户类型。我的RegisterController中有这个]
protected function create(array $data) { return User::create([ 'name' => $data['name'], 'email' => $data['email'], 'username' => $data['username'], 'usertype' => $data['usertype'], 'password' => Hash::make($data['password']), ]); }
当房东用户注册时,将他们带到
http://127.0.0.1:8000/dashboard
我如何使每个用户的内容不同,即1.我希望房东能够增加财产2.我希望租户能够编辑配置文件,查看他们已购买的属性。3.我希望代理人能够添加房东等财产。
我该如何实现?
在我的数据库中,我具有以下Schema :: create('users',function(Blueprint $ table){$ table-> id(); $ table-> string('name'); $ table-> string('电子邮件')-> unique()...
您可以使用Laravel策略
。例如,如果您有一个PropertyController,则可以使用以下方法来创建PropertyPolicy: