<?php
//controllers/users/collection.php
function collection($f3){
$collection = $f3->get('DB')->users;
$document = $collection->findOne();
if(!$document){
$root = [
'email'=>'xxxxx',
'name'=>'xxxxx',
'password'=>'xxxxxx',
'role'=>'xxxxx',
'thumb'=>'xxxxxx',
'info'=>'xxxxxx',
'video'=>'xxxxxx',
'date'=>'xxxxxx'
];
$collection->insertOne($root);
}
}
<?php
//controllers/login.php
function login($f3){
require_once('setting.php');
require_once('controllers/users/collection.php');
collection($f3);
$f3->mset([
'appName'=>$setting['siteTitle'],
'title'=>'ទំព័រដើម',
'date'=>$setting['date'],
'message'=>$setting['message']
]);
$view=new View;
echo $view->render('views/login.php');
}