File: plugins/tables/example.php

Recommend this page to a friend!
  Classes of Marco Cesarato  >  PHP API Database  >  plugins/tables/example.php  >  Download  
File: plugins/tables/example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP API Database
Provide access to database records via REST API
Author: By
Last change: Reformatted code (php-cs-fixer)

Added code standard,
Added hooks git for code standard,
Fixed parse where on null elements
Date: 9 months ago
Size: 560 bytes
 

Contents

Class file image Download
<?php
/**
 * Hooks - example.
 *
 * @author Marco Cesarato <cesarato.developer@gmail.com>
 */
use marcocesarato\DatabaseAPI\API;
use
marcocesarato\DatabaseAPI\Hooks;

$hooks = Hooks::getInstance();

/**
 * On write example table (POST/PUT request).
 *
 * @param $data
 *
 * @return mixed
 */
function filter_on_write_example($data, $table)
{
   
$db = API::getConnection(); // PDO Object
    /*
     $data['uuid'] = uniqid();
     $data['timestamp'] = time();
    */

   
return $data;
}

$hooks->add_filter('on_write_example', 'filter_on_write_example');


For more information send a message to info at phpclasses dot org.