blob: 236018f1ffe1b379cb816f2633aa6decf62b5ab6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Cache;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Anime;
use App\AnimeStats;
class ApiController extends Controller {
public function getAnime( $mal_id ) {
$anime = Anime::where('mal_id', $mal_id)->get()->first();
$anime["stats"] = $anime->getStats()->orderBy('created_at', 'asc')->get();
return response()->json( $anime, 200, array(), JSON_PRETTY_PRINT );
}
}
|