Skip to content

Does not work hasMany #1540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
viacheslavpleshkov opened this issue Jun 13, 2018 · 3 comments
Closed

Does not work hasMany #1540

viacheslavpleshkov opened this issue Jun 13, 2018 · 3 comments

Comments

@viacheslavpleshkov
Copy link
Author

The problem was solved.

@LynX39
Copy link

LynX39 commented Dec 7, 2018

The problem was solved.

Please post your solutions. Thanks.

@viacheslavpleshkov
Copy link
Author

Model User

public function role()
    {
        return $this->belongsTo('App\Role');
    }

Model Role

 public function users()
    {
        return $this->hasMany('App\User');
    }

Controllers User

public function index()
    {
        $main = User::all();
        return view('admin.users.index', compact('main'));
    }

View
{{ $item->role->name }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants