View .gitignore
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
# | |
# If all files excluded and you will include only specific sub-directories | |
# the parent path must matched before. | |
# | |
/** | |
!/.gitignore | |
############################### | |
# Un-ignore the affected subdirectory |
View split name into first and last.sql
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
UPDATE tbl t1, | |
( | |
SELECT | |
id, | |
TRIM(SUBSTRING(name, 1, LENGTH(name) - LENGTH(SUBSTRING_INDEX(name, ' ', -1)))) AS first_name, | |
SUBSTRING_INDEX(name, ' ', -1) AS last_name | |
FROM reviews | |
WHERE first_name IS NULL | |
) t2 |
View artisan log sql.php
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
DB::listen(function ($query) { dump($query->sql); dump($query->bindings); dump($query->time); echo PHP_EOL . PHP_EOL; }); |
View bind-unknown-num-params.php
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 | |
$arr = [1,2,3]; | |
$in = str_repeat('?,', count($arr) - 1) . '?'; | |
$sql = "SELECT * FROM table WHERE column IN ($in)"; | |
$stm = $db->prepare($sql); | |
$stm->execute($arr); | |
$data = $stm->fetchAll(); |