Initial commit - Katica Bufe project
This commit is contained in:
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
68
app/Http/Controllers/forgalomController.php
Normal file
68
app/Http/Controllers/forgalomController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Forgalom;
|
||||
|
||||
class forgalomController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$adatok = Forgalom::all()->map(function($elem) {
|
||||
return [
|
||||
"Név:"=> $elem->termek,
|
||||
"Ár:"=> $elem->nettoar
|
||||
|
||||
];
|
||||
});
|
||||
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)
|
||||
{
|
||||
$rekord = Forgalom::find($request["id"]);
|
||||
if(!$rekord){
|
||||
return response("Nem létező rendelés",400);
|
||||
}
|
||||
$rekord->update(["kiadva"=>true]);
|
||||
return response("Sikeres frissítés",200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
$torol = Forgalom::find($id);
|
||||
if(!$torol){
|
||||
return response("Nem létező rendelés",404);
|
||||
}
|
||||
$torol->delete();
|
||||
return response("Sikeres törlés",204);
|
||||
|
||||
}
|
||||
}
|
||||
50
app/Http/Controllers/kategoriaController.php
Normal file
50
app/Http/Controllers/kategoriaController.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Kategoria;
|
||||
|
||||
class kategoriaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$adatok = Kategoria::all();
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user