esemve / hook Goto Github PK
View Code? Open in Web Editor NEWSimple Hook engine for Laravel 5
License: MIT License
Simple Hook engine for Laravel 5
License: MIT License
Hi! I ve a question, imagine that I ve an article with a price X. This price can be varied through hooks, BUT, it's possible to not have to pass through all the hooks? maybe the first one give me a final price.. I don't know if there's the possibility to create something like a hook "break" and return the price I ve at this moment... have I made myself understood? thanks!
Hook::listen('fillUser', function ($callback, $output, $user) {
if (empty($output))
{
$output = $user;
}
$output['__hook'] = 'run';
return $output;
});
$user = ['username' => 'test', 'password' => '123'];
$user = Hook::get('fillUser', [$user], function($user) {
// Why is it not running here?
return $user;
});
I don't understand, what is the use of the following code?
function($user) {
return $user;
}
when 2 separate provider call blade hook and each return own views the hook just return latest view
but in wordpress for example hook will return all returning view by sort
There is an error in blade templates documentation.
To listen blade templates we need to listen template.hookName
instead of just hookName
Should we override listeners ?
If you have modular application - you don't know on which position your module land in the system.
If you don't specify priority, listeners will be overrided.
If you do, and you may have collision with other module created by other peoples.
Maybe some kind of auto incrementing index will be better approach?
It will be great to have something like this:
@hook('some_place')
Some content
@endhook
\Hook::listen('template.some_place',function($callback, $output, $variables, $content){
return $content."haha!";
});
This package is awesome, good job.
One question, what's the best practice of putting the listen code?
Now I put it in middleware, it work fine from the web, but can not access from command line.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.