Это делается с помощью функции PHP array_search
:
$families = session()->pull('families', []);
if(($key = array_search($deleteID, $families)) !== false) {
unset($families[$key]);
}
session()->put('families', $families);
// PS: specify index you want to remove on $deleteID variable
или более простой способ:
$index = 0; // let's say it's index 0
$families = Session::get('families'); // save the array
unset($families[$index]); // remove value from array based on index
Session::put('families', $families); // set the array again
// PS: specify index you want to remove on $index variable