Models
Issuesphp features a core model called ipmodel that simplifies SQL queries to databases.
use Issues\Model\IpModel;
Select
Let’s look at how to select all records from a table. If you need to connect to multiple databases, simply add the connection number; if you do not provide a number, it will connect to the first database by default.
IpModel::chosenAll($tableName,$databaseNumber);
Let’s look at how to select by ID: the first method returns empty if it doesn’t find the record, while the second throws a 404 exception. Use whichever suits your application’s needs.
IpModel::chosenOne($this->table,$id);
IpModel::chosenOrLost($this->table,$id);
Insert
let's look at how to insert.
IpModel::introduce($tableName,$rowFields);
Let's look at how to insert users using a special method.
IpModel::introduceUser($tableName,$rowFields);
Delete
Let's look at how to delete records.
IpModel::slipk($tableName,$id);