Model
Retrieve, edit and store
The Ivy\Model class serves as a foundational element within the ivy ecosystem, providing a flexible and efficient means of interacting with databases. Designed to streamline database operations, this class empowers developers to effortlessly manage data retrieval, manipulation, and storage within their applications.
It is designed with extensibility in mind, allowing developers to extend its functionality to suit their specific use cases. By leveraging inheritance, developers can build upon the core features of this class and tailor its behavior to meet the unique requirements of their applications.
<?php
namespace Tag;
use Ivy\Model;
class Item extends Model {
protected $table = 'tag';
protected $path = _BASE_PATH . 'plugin/Tag';
}
By extending the Ivy\Model class, the Tag\Item class inherits database manipulation capabilities, allowing developers to efficiently manage data related to tags within their application.
$router->post('/tag/post', function() {
(new \Tag\Item)->post();
});
$all_tags = (new \Tag\Item)->get()->data();
$single_tag = (new \Tag\Item)->where('id',$id)->getRow()->data();