当前位置: 首页 > news >正文

昆明做公司网站销售平台有哪些

昆明做公司网站,销售平台有哪些,开通网站费用怎么做分录,网站开发动静分离实践这里使用到三张表,一张是用户(users),一张是角色(roles),一张是用户角色关联表(users_roles), 首先创建用户模型、角色模型 php bin/hyperf.php gen:model users php bin/hyperf.php gen:model rolesusers…

这里使用到三张表,一张是用户(users),一张是角色(roles),一张是用户角色关联表(users_roles),
首先创建用户模型、角色模型

php bin/hyperf.php gen:model users
php bin/hyperf.php gen:model roles

users模型

<?php
declare (strict_types=1);
namespace App\Model;use Hyperf\DbConnection\Model\Model;
/*** users模型 */
class users extends Model
{protected $connection = 'sso';protected $primaryKey = 'ID';//因为我表里的主键是大写的,所以这里我用大写,否则使用关联模型会出问题/*** The table associated with the model.** @var string*/protected $table = 'users';/*** The attributes that are mass assignable.** @var array*/protected $fillable = [];/*** The attributes that should be cast to native types.** @var array*/protected $casts = [];/*多对多建立关系*/public function roles(){return $this->belongsToMany(roles::class,'users_roles','userId','roleId');}
}

roles模型

<?phpdeclare (strict_types=1);
namespace App\Model;use Hyperf\DbConnection\Model\Model;
/*** roles模型*/
class roles extends Model
{protected $connection = 'sso';protected $primaryKey = 'ID';/*** The table associated with the model.** @var string*/protected $table = 'roles';/*** The attributes that are mass assignable.** @var array*/protected $fillable = [];/*** The attributes that should be cast to native types.** @var array*/protected $casts = [];public function users(){return $this->belongsToMany(users::class,'users_roles','roleId','userId');}
}
  • 1、其中users_roles是我关联表的表名

  • 2、belongsToMany方法中,第一个参数,参数的与之关联的表模型;第二个参数是两个表的关联表(中间表);第三个参数是定义此关联的模型在连接表里的外键名;第四个参数是另一个模型在连接表里的外键名;

分页数据

public function paginate()
{$data = Db::table('hlyun_sso_users')->paginate(10);return $data;
}
http://www.khdw.cn/news/51892.html

相关文章:

  • 所有搜索引擎蜘蛛不来网站了网站空间费用一年多少
  • wordpress 修改链接网站快速排名优化价格
  • 国外的贸易网站推广员是做什么的
  • 如何制作可以下单的网站网络营销与策划试题及答案
  • 咸阳做网站的公司一句话让客户主动找你
  • 台州网站建设多少钱百度下载安装2021最新版
  • 国展做网站的公司视频广告接单平台
  • 佛山乐居装饰公司深圳百度搜索排名优化
  • 本地网站制作深圳网络推广培训机构
  • iis里如何装php网站十大引擎网址
  • 做响应式网站设计师如何布局呢搜狗输入法下载安装
  • 综合b2b的代表网站有哪些谷歌优化的最佳方案
  • 网站首页页面设计软件开发公司简介
  • 个人做医疗类网站违法?seo是什么姓
  • 政府建设行业服务网站真正免费建站网站
  • 建企业网站需要哪些资料seo公司优化方案
  • 如何在自己的网站上做友情链接培训网站源码
  • 单机网页制作seo课程培训要多少钱
  • 做网站分辨率设置多少中国国家培训网靠谱吗
  • 重庆学校网站推广百度关键词收录排名
  • 给周杰伦做网站50个市场营销经典案例
  • wordpress站外链接跳转页面网络舆情分析师
  • 手机怎样制作个人网站怎么关键词优化网站
  • 做视频网站服务器淘宝一个关键词要刷多久
  • wordpress 2栏主题新浪博客seo
  • 重庆商城网站建设地址网站排名推广软件
  • 怎么把自己做的网站发布出去网上互联网推广
  • 网站运营需要++做哪些工作百度账号怎么改名字
  • 网站建设公司的服务器16种营销模型
  • 百度做一个网站怎么做呢网络营销策划方案框架