added things

This commit is contained in:
szabomarton
2025-03-10 13:58:21 +01:00
parent 33371852e0
commit c4f2c7fbcb
127 changed files with 20894 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Http\Controllers;
use App\Models\Ingatlan;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class IngatlanController extends Controller
{
public function index(): JsonResponse{
return response()->json(Ingatlan::getAllWithCategory(), 200);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Ingatlan extends Model
{
//use HashFactory;
protected $table='ingatlanok';
protected $fillable = ['kategoria', 'leiras', 'hirdetesDatuma', 'tehermentes', 'ar', 'kepUrl'] ;
public $timestamps = false;
public function kategoriak(){
return $this->belongsTo(Kategoria::class, 'kategoria');
}
public static function getAllWithCategory(){
return self::with('kategoriak:id,nev')->get()->map(function ($ingatlan){
return [
'id' => $ingatlan->id,
'kategoria' => $ingatlan->kategoriak->nev ?? null,
'leiras' => $ingatlan->leiras,
'hirdetesDatuma' => $ingatlan->hirdetesDatuma,
'tehermentes' => $ingatlan->tehermentes,
'ar' => $ingatlan->ar,
'kepUrl' => $ingatlan->kepUrl,
];
});
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Kategoria extends Model
{
protected $table='kategoriak';
protected $fillable = ['nev'] ;
public function ingatlanok(){
return $this->hasMany(Ingatlan::class, 'kategoria');
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}