1. Go to this page and download the library: Download coffeecode2/datalayer2 library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$addresses = new Address();
$address = $addresses->findById(22);
//get user data to this->user->[all data]
$address->user();
var_dump($address);
use Example\Models\User;
$model = new User();
$count = $model->find()->count();
use Example\Models\User;
$user = new User();
$user->first_name = "Robson";
$user->last_name = "Leite";
$userId = $user->save();
use Example\Models\User;
$user = (new User())->findById(2);
$user->first_name = "Robson";
$userId = $user->save();
use Example\Models\User;
$user = (new User())->findById(2);
$user->destroy();
use Example\Models\User;
$user = (new User())->findById(2);
if($user->fail()){
echo $user->fail()->getMessage();
}
class User{
//...
public function fullName(): string
{
return "{$this->first_name} {$this->last_name}";
}
public function document(): string
{
return "Restrict";
}
}
echo $this->full_name; //Robson V. Leite
echo $this->document; //Restrict
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.