foreach return only one record code example

foreach return only one record

2

2 Examples

0
<div id="defaultcontainerwrapper" class="maxwidth">
    <header>
        <h1>
            <div class="list">
                <span>Welcome to </span><?php echo $this->challengenames[0]['partnerName']; ?><span>'s Beat Waste Challenge!</span>
            </div>
        </h1>
    </header>
</div>
by on

0
foreach ($users as $user) {
    // you only need 1 query, not 3
    $timeline = Timeline::whereUserId($user->friend_id)->first();

    $data[] = [
        'uid' => $timeline->user_id,
        'username' => $timeline->username,
        'name' => $timeline->name
    ];
}
by on

Other Code Examples