PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.95
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.95
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / app / Models / SpaceUserPivot.php

SpaceUserPivot.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.95, at app/Models/SpaceUserPivot.php

59 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\App\Models;
4
5 use FluentCommunity\App\Models\Model;
6 use FluentCommunity\App\Models\XProfile;
7
8 class SpaceUserPivot extends Model
9 {
10 protected $table = 'fcom_space_user';
11
12 protected $guarded = ['id'];
13
14 protected $fillable = [
15 'space_id',
16 'user_id',
17 'status',
18 'role'
19 ];
20
21 public function scopeBySpace($query, $spaceId)
22 {
23 if (!$spaceId) {
24 return $query;
25 }
26
27 $query->where('space_id', $spaceId);
28
29 return $query;
30 }
31
32
33 public function scopeByUser($query, $userId)
34 {
35 if (!$userId) {
36 return $query;
37 }
38
39 $query->where('user_id', $userId);
40
41 return $query;
42 }
43
44 public function user()
45 {
46 return $this->belongsTo(User::class, 'user_id', 'ID');
47 }
48
49 public function xprofile()
50 {
51 return $this->belongsTo(XProfile::class, 'user_id', 'user_id');
52 }
53
54 public function space()
55 {
56 return $this->belongsTo(BaseSpace::class, 'space_id', 'id')->withoutGlobalScopes();
57 }
58 }
59