2019-10-29 15:33:36 +08:00
|
|
|
<?php
|
|
|
|
|
2020-01-29 16:08:50 +08:00
|
|
|
namespace App\Http\Controllers\User;
|
2019-10-29 15:33:36 +08:00
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2020-01-29 16:08:50 +08:00
|
|
|
use Illuminate\Http\Request;
|
2019-10-29 15:33:36 +08:00
|
|
|
use App\Models\Plan;
|
|
|
|
|
|
|
|
class PlanController extends Controller
|
|
|
|
{
|
2020-01-11 13:36:52 +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
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|