2019-10-29 15:33:36 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\Plan;
|
|
|
|
|
|
|
|
class PlanController extends Controller
|
|
|
|
{
|
2019-12-23 16:12:35 +08:00
|
|
|
public function fetch (Request $request) {
|
2020-01-03 21:04:44 +08:00
|
|
|
if ($request->input('id')) {
|
|
|
|
$plan = Plan::where('id', $request->input('id'))
|
|
|
|
->first();
|
|
|
|
if (!$plan) {
|
|
|
|
abort(500, '该订阅不存在');
|
|
|
|
}
|
|
|
|
return response([
|
|
|
|
'data' => $plan
|
|
|
|
]);
|
2019-10-29 15:33:36 +08:00
|
|
|
}
|
2020-01-03 21:04:44 +08:00
|
|
|
$plan = Plan::where('show', 1)
|
|
|
|
->get();
|
2019-10-29 15:33:36 +08:00
|
|
|
return response([
|
|
|
|
'data' => $plan
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|