forked from eatvio/eatvio-infra
static analisys refactoryn, View types added
This commit is contained in:
@@ -5,15 +5,12 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Plan;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
|
||||
class PlanController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): View|ViewFactory
|
||||
{
|
||||
if ($request->has('author')) {
|
||||
$author = $request->get('author');
|
||||
@@ -26,31 +23,12 @@ class PlanController extends Controller
|
||||
return view('plan/index', ['plans' => $plans]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(): View|ViewFactory
|
||||
{
|
||||
return view('plan/edit_form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Plan $plan)
|
||||
public function show(Plan $plan): View|ViewFactory
|
||||
{
|
||||
$expiresAt = now()->addHours(24);
|
||||
|
||||
@@ -58,58 +36,11 @@ class PlanController extends Controller
|
||||
->cooldown($expiresAt)
|
||||
->record();
|
||||
|
||||
// $options1 = $this->unserializeOptions($plan->packet1_options);
|
||||
// $options2 = $this->unserializeOptions($plan->packet2_options);
|
||||
// $options3 = $this->unserializeOptions($plan->packet2_options);
|
||||
// $options1 = $plan->packet1_options;
|
||||
// $options2 = $plan->packet2_options;
|
||||
// $options3 = $plan->packet2_options;
|
||||
|
||||
return view(
|
||||
'plan/show',
|
||||
[
|
||||
'plan' => $plan,
|
||||
// 'options1' => $options1,
|
||||
// 'options2' => $options2,
|
||||
// 'options3' => $options3,
|
||||
]
|
||||
);
|
||||
return view('plan/show', ['plan' => $plan]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Plan $plan)
|
||||
public function edit(Plan $plan): View|ViewFactory
|
||||
{
|
||||
return view('plan/edit_form', ['plan' => $plan]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Plan $plan)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Plan $plan)
|
||||
{
|
||||
}
|
||||
|
||||
private function unserializeOptions($str)
|
||||
{
|
||||
if (preg_match('/^".*"$/', $str)) {
|
||||
return json_decode(stripslashes(mb_substr($str, 1, -1)), true);
|
||||
}
|
||||
|
||||
return json_decode(stripslashes($str), true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user