kesz feladat
This commit is contained in:
65
.env.example
65
.env.example
@@ -1,65 +0,0 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
# PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
# DB_HOST=127.0.0.1
|
||||
# DB_PORT=3306
|
||||
# DB_DATABASE=laravel
|
||||
# DB_USERNAME=root
|
||||
# DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
@@ -19,6 +19,7 @@ class poloController extends Controller
|
||||
|
||||
];
|
||||
});
|
||||
return response()->json($adatok,200,["Content-Type"=>"application/json"]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,14 @@ class poloController extends Controller
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +58,11 @@ class poloController extends Controller
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
$torlendo=Polo::find($id);
|
||||
if(!$torlendo){
|
||||
return response("Sikertelen törlés",404);
|
||||
}
|
||||
$torlendo->delete();
|
||||
return response("",204);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,15 @@ class vasarloController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$adatok=Vasarlo::all()->map(function ($elem){
|
||||
return[
|
||||
"nev"=>$elem->nev,
|
||||
"ar"=>$elem->polo->ar
|
||||
];
|
||||
});
|
||||
return response()->json($adatok,200,["Content-Type"=>"application/json"]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,9 +42,17 @@ class vasarloController extends Controller
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
$frissit = Vasarlo::find($request["id"]);
|
||||
if(!$frissit){
|
||||
return response("Sikertelen frissítés",400);
|
||||
}
|
||||
$frissit->update([
|
||||
"nev"=>$request["nev"],
|
||||
"torzsvasarloSzam"=>$request["torzsvasarloSzam"]
|
||||
]);
|
||||
return response()->json("Sikeres frissítés",200);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,6 +60,11 @@ class vasarloController extends Controller
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
$torlendo=Vasarlo::find($id);
|
||||
if(!$torlendo){
|
||||
return response("Sikertelen törlés",404);
|
||||
}
|
||||
$torlendo->delete();
|
||||
return response("",204);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,16 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use App\Models\Vasarlo;
|
||||
|
||||
class Polo extends Model
|
||||
{
|
||||
protected $table = "polo";
|
||||
protected $fillabe = [];
|
||||
protected $fillable = ["anyag", "polomeret", "ar", "cimke", "atmero"];
|
||||
public $timestamps = false;
|
||||
|
||||
public function vasarlo(){
|
||||
return $this->hasMany(Vasarlo::class, "poloId");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Polo;
|
||||
|
||||
class Vasarlo extends Model
|
||||
{
|
||||
protected $table = "polo";
|
||||
protected $fillabe = [];
|
||||
protected $table = "vasarlo";
|
||||
protected $fillable = ["id","nev","meret","torzsvasarloSzam"];
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
public function polo(){
|
||||
return $this->belongsTo(Polo::class, "poloId");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,3 +9,7 @@ Route::get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
})->middleware('auth:sanctum');
|
||||
Route::get("/polok",[poloController::class, "index"]);
|
||||
Route::get("/vasarlok",[vasarloController::class, "index"]);
|
||||
Route::delete("/vasarlo/torles/{id}",[vasarloController::class, "destroy"]);
|
||||
Route::put("/polo/frissit/{id}",[poloController::class, "update"]);
|
||||
Route::put("/vasarlo/frissit",[vasarloController::class, "update"]);
|
||||
Reference in New Issue
Block a user