Guest User

Untitled

a guest
Jun 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. namespace AppHttpControllers;
  2. use IlluminateHttpRequest;
  3. use AppHttpRequestsUserRequest;
  4. use AppEmployee;
  5. use AppRole;
  6. use AppUser;
  7. use AppSite;
  8. use AppClient;
  9. use AppProjectType;
  10. use AppUserPermission;
  11. use Auth;
  12. use DB;
  13. use AppProject;
  14.  
  15. class UsersController extends BaseController {
  16.  
  17. public function __construct() {
  18. $this->isSetClientAndProjectType();
  19.  
  20. $data = User::with('Role')->first();
  21. echo "<pre>";print_r(json_decode($data)); die;
  22.  
  23. }
  24. }
  25.  
  26. namespace App;
  27. use IlluminateNotificationsNotifiable;
  28. use IlluminateFoundationAuthUser as Authenticatable;
  29. use IlluminateDatabaseEloquentSoftDeletes;
  30.  
  31. class User extends Authenticatable {
  32.  
  33. use SoftDeletes;
  34.  
  35. use Notifiable;
  36.  
  37. protected $fillable = [
  38. 'name', 'role_id', 'password', 'siteid', 'email', 'status', 'allowed_to_bypass_pm', 'allowed_to_bypass_admin'
  39. ];
  40. protected $hidden = [
  41. 'password', 'remember_token',
  42. ];
  43.  
  44. // Get users roles
  45. public function Role() {
  46. return $this->hasMany('AppRole', 'role_id', 'id');
  47. }
  48. }
  49.  
  50. namespace App;
  51. use IlluminateNotificationsNotifiable;
  52. use IlluminateFoundationAuthUser as Authenticatable;
  53. use IlluminateDatabaseEloquentSoftDeletes;
  54.  
  55. class User extends Authenticatable {
  56.  
  57. use SoftDeletes;
  58.  
  59. use Notifiable;
  60.  
  61. protected $fillable = [
  62. 'name', 'role_id', 'password', 'siteid', 'email', 'status', 'allowed_to_bypass_pm', 'allowed_to_bypass_admin'
  63. ];
  64. protected $hidden = [
  65. 'password', 'remember_token',
  66. ];
  67.  
  68. // Get users roles
  69. public function role() {
  70. return $this->belongsTo('AppRole');
  71. }
  72. }
  73.  
  74. $user = User::with('role')->first();
Add Comment
Please, Sign In to add comment