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
function humanJoin($array , $glue = ', ',$finalGlue = ' ve '){ | |
$arr = [implode($glue,array_slice($array,0,-1)),...array_slice($array,-1)]; | |
$arr = array_filter($arr,function($e){ | |
return $e != ''; | |
}); | |
return implode($finalGlue,$arr); | |
} | |
echo humanJoin(['Ali','Veli','Mehmet']); |
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 | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Validator; | |
class indexController extends Controller | |
{ | |
public function index(){ | |
return view('form'); |
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 | |
$db = new PDO("mysql:host=localhost;dbname=nestable;charset=utf8","root","123123asdasd"); | |
function getTreeArray($parentId,$treeArray = '') | |
{ | |
global $db; | |
if(!is_array($treeArray)){ $treeArray = [];} | |
$data = $db->query("select * from menu where parentId='".$parentId."'")->fetchAll(PDO::FETCH_ASSOC); | |
foreach ($data as $key => $item) { |