Ekapp/skolehjem/app/Http/Controllers/FeedbackController.php

99 lines
1.9 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Feedback;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class FeedbackController extends Controller
{
/**
* Display a listing of the resource.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$feedback = Feedback::query()->paginate($request->input("limit", 20));
return Response::detect("feedback.index", [ "feedback" => $feedback ]);
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
return Response::detect("feedback.create");
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$requestBody = $request->validate([
"name" => "required|max:255",
"link" => "required|max:255"
]);
$feedback = new Feedback($requestBody);
$feedback->save();
return Response::detect("feedback.store");
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
return Response::detect("feedback.show", [ "feedback" => $id]);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return void
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}