?
Current File : /home/sanghavirealty/public_html/appazwer/Models/Property.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;

class Property extends Model
{
    use HasFactory; 
    /**
     * The attributes that are mass assignable.
     * The `slug` and `uuid` are not included as they are typically generated automatically.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'category',
        'type',
        'headline',
        'quote',
        'title',
        'subtitle',
        'highlights1',
        'highlights2',
        'highlights3',
        'highlights4',
        'highlights5',
        'highlights6',
        'videoembeedlink',
        'location',
        'description',
        'price',
        'video',
        'reranotice',
        'projectstatus',
    ];


    protected static function boot()
    {
        parent::boot();

        // This event is fired before a model is saved for the first time
        static::creating(function ($property) {
            $property->uuid = Str::uuid();
            $property->slug = Str::slug($property->title . '-' . Str::random(5));
        });
    }



    /**
     * Get the images associated with the property.
     * This defines a one-to-many relationship.
     */
    public function images(): HasMany
    {
        return $this->hasMany(PropertyImage::class);
    }

    

    public static function getEntireListForNavigation(){

return Property::orderBy('type', 'DESC')->get();


// Property::all()->sortBy('type')->orderBy('type', 'DESC');



    }



}