İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Try catch kullanarak index değerine göre yoksa ekler
|
||||
*/
|
||||
function firstOrCreate($data, $table, $debug=false) {
|
||||
|
||||
try {
|
||||
$data['created_at'] = simdi();
|
||||
$id = db($table)->insertGetId($data);
|
||||
return $id;
|
||||
} catch (\Throwable $th) {
|
||||
if($debug) {
|
||||
dump($th);
|
||||
}
|
||||
}
|
||||
|
||||
} ?>
|
||||
Reference in New Issue
Block a user