Joywork/constructor/Controllers/ObjectController.php

24 lines
546 B
PHP
Raw Normal View History

2026-05-22 20:21:54 +02:00
<?php
class ObjectController extends BaseController
{
public $model = null;
public function __construct() {
$this->model = new ObjectModel();
}
public function index()
{
// global $agent;
$objects = $this->model->getAll();
return $this->response($objects);
}
public function getOne($params) {
$object = $this->model->getOnlyOne($params);
if (empty($object)) {
http_response_code(404);
return $this->response(['message' => 'Object not found']);
} else return $this->response($object);
}
}