コード例 #1
0
 public function index()
 {
     $qb = User::with('profile');
     $qb->whereHas('roles', function ($query) {
         $query->where('slug', 'authenticated_user');
     });
     $members = $qb->paginate(50);
     return view('admin.members.index', ['members' => $members]);
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: yohanes1989/goprop
 public function index()
 {
     $qb = User::with('profile');
     $qb->whereHas('roles', function ($query) {
         $query->whereIn('slug', ['property_manager', 'normal_administrator']);
     });
     $users = $qb->paginate(50);
     return view('admin.users.index', ['users' => $users]);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->boolean('manage_property')->default(FALSE)->nullable();
     });
     $qb = \GoProp\Models\User::with('profile');
     $qb->whereHas('roles', function ($query) {
         $query->where('slug', 'agent');
     });
     $agents = $qb->get();
     foreach ($agents as $agent) {
         $agent->manage_property = TRUE;
         $agent->save();
     }
 }
コード例 #4
0
 public function index()
 {
     $qb = User::with('profile');
     $qb->whereHas('roles', function ($query) {
         $query->where('slug', 'agent');
     });
     $user = Auth::user();
     if ($user->is('property_manager')) {
         $qb->whereHas('profile', function ($query) use($user) {
             $query->where('province', $user->profile->province);
         });
     }
     $agents = $qb->paginate(50);
     return view('admin.agents.index', ['agents' => $agents]);
 }