fipamo/app/Http/Controllers/RouteDeleteController.php

30 lines
719 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Interfaces\PageRepositoryInterface;
class RouteDeleteController extends Controller
{
protected $page;
public function __construct(
PageRepositoryInterface $pageRepo
) {
$this->page = $pageRepo;
}
public function handleRequest(Request $request)
{
$path = explode('/', $request->path());
switch ($path[0]) {
case 'page':
$body = json_decode($request->getContent());
$result = $this->page->delete($body);
return response()->json($result)->header('Content-Type', 'application/json');
break;
}
}
}