Include EntityModel.php to your PHP file and use the namespace Lynq\Entity\EntityModel;
You can also remove the namepsace from the EntityModel.php and you are good to go.
Example
<?php use Lynq\Entity\EntityModel; class PracticeModel { private $table = 'Media'; /** * Connect to database in constructor */ public function __construct() { $dsn = 'mysql:dbname=airMediaDB;host=127.0.0.1'; $user = 'root'; $password = 'glory'; $this->mediaDB = new EntityModel($dsn, $user, $password); } /** * Get ALL items via search $key */ public function getItems($key) { return $this->mediaDB->table($this->table) ->where('title', 'LIKE', '%'.$key.'%') ->orderBy('id') ->get(); }
Top comments (0)