Answers for "last() laravel"

PHP
6

laravel get last record

Model::latest()->first();
Posted by: Guest on May-06-2020
1

array_last in laravel 8

use Illuminate\Support\Arr;

$array = [100, 200, 300, 110];

$last = Arr::last($array, function ($value, $key) {
    return $value >= 150;
});

// 300
Posted by: Guest on September-21-2021

Browse Popular Code Answers by Language