2020-07-10 17:07:34 +05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use App\Http\HttpHelper;
|
|
|
|
use Jenssegers\Mongodb\Eloquent\Model;
|
|
|
|
use Jikan\Helper\Media;
|
|
|
|
use Jikan\Helper\Parser;
|
|
|
|
use Jikan\Jikan;
|
|
|
|
use Jikan\Model\Common\YoutubeMeta;
|
|
|
|
use Jikan\Request\Magazine\MagazinesRequest;
|
|
|
|
|
|
|
|
/**
|
2020-07-10 20:09:26 +05:00
|
|
|
* Class Magazine
|
2020-07-10 17:07:34 +05:00
|
|
|
* @package App
|
|
|
|
*/
|
2020-07-10 20:09:26 +05:00
|
|
|
class Magazine extends Model
|
2020-07-10 17:07:34 +05:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
|
|
|
'mal_id', 'name', 'url', 'count'
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The table associated with the model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $table = 'magazines';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes excluded from the model's JSON form.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $hidden = [
|
|
|
|
'_id', 'expiresAt'
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public static function scrape() : array
|
|
|
|
{
|
|
|
|
$data = app('JikanParser')->getMagazines(new MagazinesRequest());
|
|
|
|
|
|
|
|
return json_decode(
|
|
|
|
app('SerializerV4')
|
|
|
|
->serialize($data, 'json'),
|
|
|
|
true
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|