vendredi 1 avril 2016

Write function in laravel which needs to execute before any controller

Hi i am doing a website in laravel. I am trying to do like a function that needs to execute before any controller.

Example : I have function like

function xyz(){
    //do code here
}

This function need to execute when user on site by refreshing page or doing some ajax requst.

I am aware with the codeigniter there is a way to do this using hook

$hook['pre_controller'] = array(
        'class'    => 'MyClass',
        'function' => 'Myfunction',
        'filename' => 'Myclass.php',
        'filepath' => 'hooks',
        'params'   => array('beer', 'wine', 'snacks')
);

What is the way in laravel to do this ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire