Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AppHttpControllers;
- use IlluminateHttpRequest;
- use AppHttpRequestsUserRequest;
- use AppEmployee;
- use AppRole;
- use AppUser;
- use AppSite;
- use AppClient;
- use AppProjectType;
- use AppUserPermission;
- use Auth;
- use DB;
- use AppProject;
- class UsersController extends BaseController {
- public function __construct() {
- $this->isSetClientAndProjectType();
- $data = User::with('Role')->first();
- echo "<pre>";print_r(json_decode($data)); die;
- }
- }
- namespace App;
- use IlluminateNotificationsNotifiable;
- use IlluminateFoundationAuthUser as Authenticatable;
- use IlluminateDatabaseEloquentSoftDeletes;
- class User extends Authenticatable {
- use SoftDeletes;
- use Notifiable;
- protected $fillable = [
- 'name', 'role_id', 'password', 'siteid', 'email', 'status', 'allowed_to_bypass_pm', 'allowed_to_bypass_admin'
- ];
- protected $hidden = [
- 'password', 'remember_token',
- ];
- // Get users roles
- public function Role() {
- return $this->hasMany('AppRole', 'role_id', 'id');
- }
- }
- namespace App;
- use IlluminateNotificationsNotifiable;
- use IlluminateFoundationAuthUser as Authenticatable;
- use IlluminateDatabaseEloquentSoftDeletes;
- class User extends Authenticatable {
- use SoftDeletes;
- use Notifiable;
- protected $fillable = [
- 'name', 'role_id', 'password', 'siteid', 'email', 'status', 'allowed_to_bypass_pm', 'allowed_to_bypass_admin'
- ];
- protected $hidden = [
- 'password', 'remember_token',
- ];
- // Get users roles
- public function role() {
- return $this->belongsTo('AppRole');
- }
- }
- $user = User::with('role')->first();
Add Comment
Please, Sign In to add comment