<?php
namespace App\Models;

use App\Core\Model;

class Property extends Model
{
    public function getAll()
    {
        $stmt = $this->query("SELECT * FROM properties ORDER BY name");
        return $stmt->fetchAll();
    }

    public function find($id)
    {
        $stmt = $this->query("SELECT * FROM properties WHERE id = ?", [$id]);
        return $stmt->fetch();
    }

    public function create($data)
    {
        return $this->insert('properties', $data);
    }
}