Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #########################################CONTROLLER###################################################
- <?php
- namespace App\Http\Controllers;
- use App\helpModel;
- class HelpController extends Controller
- {
- function Help(){
- $manualContent = helpModel::GetManualContent();
- $manual = helpModel::ProcessManualContent($manualContent);
- return $manual;
- }
- }
- #########################################Model###############################################################
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class helpModel extends Model
- {
- static function GetManualContent(){
- $manualContent = array(
- "version 1.0" => array(
- "/api/v1/GET/beacon/..." => array(
- "content" => array(
- "/api/v1/GET/beacon" => array(
- "input" => 'N/A',
- "output" => 'all beacons',
- ),
- "/api/v1/GET/beacon/{beaconId}" => array(
- "input" => 'beaconId (integer)',
- "output" => 'a specific beacon',
- ),
- "/api/v1/GET/beacon/{beaconId}/staticData" => array(
- "input" => 'beaconId (integer)',
- "output" => 'all static data for a specific beacon',
- ),
- "/api/v1/GET/beacon/{beaconId}/staticData/{dataId}" => array(
- "input" => 'beaconId (integer) <b>+</b> dataId (integer)',
- "output" => 'specific static data for a specific beacon',
- ),
- "/api/v1/GET/beacon/{beaconId}/route" => array(
- "input" => 'beaconId (integer)',
- "output" => 'all routes for a specific beacon',
- ),
- "/api/v1/GET/beacon/{beaconId}/route/{routeId}" => array(
- "input" => 'beaconId (integer) <b>+</b> routeId (integer)',
- "output" => 'a specific route for a specific beacon',
- ),
- "/api/v1/GET/beacon/{beaconId}/route/{routeId}/dynamicData" => array(
- "input" => 'beaconId (integer) <b>+</b> routeId (integer)',
- "output" => 'all dynamic data for a specific beacon and route combination',
- ),
- "/api/v1/GET/beacon/{beaconId}/route/{routeId}/dynamicData/{dataId}" => array(
- "input" => 'beaconId (integer) <b>+</b> routeId (integer) <b>+</b> dataId (integer)',
- "output" => 'specific dynamic data for a specific beacon and route combination',
- ),
- ),
- ),
- ),
- );
- return $manualContent;
- }
- static function ProcessManualContent($manualContent)
- {
- $processedManualContent = '';
- foreach ($manualContent as $apiVersion => $apiRouteSummary) {
- $processedManualContent .= '<h1>'.$apiVersion.'</h1> <ul style="list-style-type:none">';
- foreach ($apiRouteSummary as $apiRouteSummaryName => $apiVersionFunctions){
- $processedManualContent .= '<li> <h3>'.$apiRouteSummaryName.'</h3> </li> <ul style="list-style-type:disc">';
- foreach ($apiVersionFunctions['content'] as $apiFunction => $apiFunctions){
- $processedManualContent .= '<li> <p> <b>'.$apiFunction.'</b> </p> </li> <ul style="list-style-type:none">';
- foreach ($apiFunctions as $valueName => $value) {
- $processedManualContent .= '<li> <p> <i>'.$valueName.':</i> '.$value.'</p> </li>';
- }
- $processedManualContent .= '</ul>';
- }
- $processedManualContent .= '</ul>';
- }
- $processedManualContent .= '</ul>';
- }
- return $processedManualContent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement