This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Function previewSql() | |
{ | |
$users = User::where(‘id’, 0); | |
$users->union(User::where(‘id’, 1)); | |
$users->union(User::where(‘id’, 2)); | |
$users->union(User::where(‘id’, 3)); | |
// Preview sql statement using getBindings() and toSql() builder methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function moveValueToTheEnd(array $array, $searchedValue) : array | |
{ | |
dump('initial array', $array); | |
$j = 0; | |
for ($i = 0; $i < (count($array)); $i++) { | |
if ($array[$i] === $searchedValue && isset($array[$i + 1])) { | |
$array[$i] = $array[$i + 1]; | |
$array[$i + 1] = $searchedValue; |