1. Go to this page and download the library: Download rdallimore/eloquence 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/ */
rdallimore / eloquence example snippets
class Post extends Eloquent {
use Countable;
public function countCaches() {
return [User::class];
}
}
class Post extends Eloquent {
use Countable;
public function countCaches() {
return [
'num_posts' => ['User', 'users_id', 'id']
];
}
}
class Post extends {
use Countable;
public function countCaches() {
return [
[
'model' => 'User',
'field' => 'num_posts',
'foreignKey' => 'users_id',
'key' => 'id'
]
];
}
}
class Item extends Eloquent {
use Summable;
public function sumCaches() {
return [Order::class];
}
}
class Item extends Eloquent {
use Summable;
public function sumCaches() {
return [
'item_total' => ['Order', 'total', 'order_id', 'id']
];
}
}
class Item extends Eloquent {
use Summable;
public function sumCaches() {
return [
[
'model' => 'Order',
'columnToSum' => 'total',
'field' => 'item_total'
'foreignKey' => 'order_id',
'key' => 'id'
]
];
}
}
class User extends Eloquent {
use Sluggable;
public function slugStrategy() {
return 'username';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.