Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shahr's avatar
Level 10

Building a Social Network with Laravel

social

We have 4 social networks now.

The user can delete or add.

It shows like this when I want to show it to the admin.

show

That's four telegrams.

My complete code is ..

blade

    <?php
    $related = json_decode($user->related_id, true);
    $social_name = $social->chump(2);

    ?>
    <div class="table-responsive">
        <table class="table table-bordered table-striped">
            @foreach($social as $key=>$fieldID)
                <tr>
                    <th>IDh {{ $social_name->name }}</th>
                    <th>{{ $related[$key] }}</th>
                </tr>
            @endforeach
        </table>
    </div>

Controller

public function social(User $user)
{
    $socials_ids = json_decode($user->social_id);
    $social = Social::whereIn('id', $socials_ids)->get();
    return view('Admin.users.socials', compact('user', 'social'));
}
0 likes
0 replies

Please or to participate in this conversation.