Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):
class Shop extends Eloquent {}
Using custom table name
protected $table = 'my_shops';
| <?php | |
| $dsn = 'mysql:host=localhost;dbname=information_schema'; | |
| $username = 'root'; | |
| $password = 'password'; | |
| $dbh = new PDO($dsn, $username, $password); | |
| $tableSchema = 'db_name'; | |
| $fkColumnName = 'emp_id'; | |
| $pkColumnName = 'admin_id'; | |
| $pkTableName = 'admin_login'; |
| server { | |
| listen 80; | |
| #listen [::]:80; | |
| server_name dev.hio.com; | |
| root /Users/jimit/Code/rl_projects/hio/api/public; | |
| access_log /Users/jimit/Code/rl_projects/hio/api/storage/local/nginx.access.log; | |
| error_log /Users/jimit/Code/rl_projects/hio/api/storage/local/nginx.error.log; | |
| location / { | |
| alias /Users/jimit/Code/rl_projects/hio/front/dist/; | |
| try_files $uri $uri/ /index.html?$args; |
| <?php | |
| /* | |
| * Mysql database class - only one connection alowed | |
| */ | |
| class Database { | |
| private $_connection; | |
| private static $_instance; //The single instance | |
| private $_host = "HOSTt"; | |
| private $_username = "USERNAME"; | |
| private $_password = "PASSWORd"; |
| const debounce = (fn = () => {}, wait = 1000) => (...args) => { | |
| const delayed = () => fn.apply(this, args) | |
| return setTimeout(delayed, wait) | |
| } |