How to get user information using hootlex/laravel-friendships package in laravel
How to get user information using hootlex/laravel-friendships package in laravel
In this article, we will see how to solve "How to get user information using hootlex/laravel-friendships package in laravel".
You can get the user information using hootlex/laravel-friendships package in laravel. Sometimes we want to access user information like name, image to display in view file in that case it helps you to access users table column data.-
Laravel friendship get user information using hootlex/laravel-friendships
{{ $invitation->sender->name }} //Get all the invitations for friendship from other users using getFriendRequests() method $invitations = Auth::user()->getFriendRequests(); return view('home')->with(['invitations'=>$invitations]); //Display user information in view file //resources\views\home.blade.php @foreach($invitations as $invitation) {{ $invitation->sender->name }} @endforeach
This code snippet helps you to get the user information like user id, name and others field value from users table who send the invitations for connect to logged in user.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- Remove array keys and values if it does not exist in other array in Laravel
- Laravel 9 route group with controller
- How to insert dynamic value to additional column in pivot table in laravel
- Add class to body in laravel view
- Class "App\Http\Controllers\Auth\Verified" not found
- 419 page expired error in Laravel
- Display message with session flash using bootstrap alert class in laravel
- Laravel change date format
- How to get query string value in laravel
- How to authenticate admin users in Laravel ?
- Target class [HomeController] does not exist
- FirstOrCreate() Not Inserting Model
- How to get only time from created_at in laravel
- How to add columns in existing table using migration in laravel
- Submit form without CSRF token in Laravel
- Use withCount() to get total number of records with relationship
- Get posts belongs to a specific user in Laravel
- Class 'App\Http\Controllers\User' not found
- How to check duplicate entry in laravel
- Laravel get single row by id
- Laravel hasmany select not working
- How to create static page in Laravel
- Laravel route redirect not working
- The use statement with non-compound name 'DB' has no effect
- Call to undefined method Illuminate\Support\Facades\Request::all()