added things
This commit is contained in:
1 parent
33371852e0
commit
c4f2c7fbcb
127 files changed
+20894
No files matched your search
@@ -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,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user