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,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,
];
});
}
}