PHP Classes

File: src/Http/Controllers/JaxonController.php

Recommend this page to a friend!
  Classes of Thierry Feuzeu   Jaxon for Laravel   src/Http/Controllers/JaxonController.php   Download  
File: src/Http/Controllers/JaxonController.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon for Laravel
Laravel plugin to call PHP classes from with AJAX
Author: By
Last change: Removed the Facade class.
Updated the plugin and the controller.
Updated the Jaxon controller
Adapted to the new class hierarchy is jaxon-core.
Compatibility with the latest jaxon-core 3.0.x version.
Fixed code style.
Fixed code style.
Date: 3 years ago
Size: 1,522 bytes
 

Contents

Class file image Download
<?php

namespace Jaxon\Laravel\Http\Controllers;

use
App\Http\Controllers\Controller;
use
Jaxon\Laravel\Jaxon;

class
JaxonController extends Controller
{
   
/**
     * Process a Jaxon request.
     *
     * The parameter is automatically populated by Laravel, thanks to its service container.
     *
     * @param Jaxon $jaxon The Laravel Jaxon plugin
     *
     * @return The HTTP response to send back to the browser
     */
   
public function process(Jaxon $jaxon)
    {
       
$jaxon->callback()->before(function ($target, &$bEndRequest) {
           
/*
            if($target->isFunction())
            {
                $function = $target->getFunctionName();
            }
            elseif($target->isClass())
            {
                $class = $target->getClassName();
                $method = $target->getMethodName();
                // $instance = $jaxon->instance($class);
            }
            */
       
});
       
$jaxon->callback()->after(function ($target, $bEndRequest) {
           
/*
            if($target->isFunction())
            {
                $function = $target->getFunctionName();
            }
            elseif($target->isClass())
            {
                $class = $target->getClassName();
                $method = $target->getMethodName();
            }
            */
       
});

       
// Process the Jaxon request
       
if($jaxon->canProcessRequest())
        {
            return
$jaxon->processRequest();
        }
    }
}