64 lines
1.2 KiB
PHP
64 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Polo;
|
|
|
|
class poloController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
$adatok = Polo::all()->map(function($elem) {
|
|
return[
|
|
"Méretek:"=>$elem->polomeret,
|
|
"Ár:"=>$elem->ar
|
|
|
|
];
|
|
});
|
|
return response()->json($adatok,200,["Content-Type"=>"application/json"]);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
$frissit = Polo::find($id);
|
|
if(!$frissit){
|
|
return response("Sikertelen frissítés",400);
|
|
}
|
|
$frissit->update([
|
|
"ar"=>$request["ar"]
|
|
]);
|
|
return response("Sikeres frissítés",200);
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
|
|
}
|
|
}
|