1. Go to this page and download the library: Download megaads/apify 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/ */
megaads / apify example snippets
namespace App\Models;
class Order extends \Megaads\Apify\Models\BaseModel
{
public function scopeCustomer($query, $params) {
if (isset($params['keyword'])) {
//do something
}
}
public function scopeOrderMeta($query, $params) {
if (isset($params['keys']) && isset($params['values'])) {
//do something
}
}
}
namespace App\Models;
class Nation extends \Apify\Models\BaseModel {
protected $table = 'location_nation';
public function cities() {
return $this->hasMany('App\Models\City', 'nation_id', id);
}
}
namespace App\Models;
class City extends \Apify\Models\BaseModel {
protected $table = 'location_city';
public function nation() {
return $this->belongsTo('App\Models\Nation', 'nation_id');
}
public function districts() {
return $this->hasMany('App\Models\District', 'city_id', id);
}
}
namespace App\Models;
class District extends \Apify\Models\BaseModel {
protected $table = 'location_district';
public function city() {
return $this->belongsTo('App\Models\City', 'city_id');
}
}
/api/post?page_id=2&page_size=20
/api/post?sorts=user_id
/api/post?fields=id,content,user_id,sum(view_count) as view_sum