Laravel 5 custom query builder functions

Hi, I finally found an easy solution for this. Just create a service provider and in the boot function do the following: $queryBuilder = app(\Illuminate\Database\Query\Builder::class); $queryBuilder::macro(‘filter’, function (\Illuminate\Http\Request $request) {}); In the example you’ll be able to attach a request object as a parameter of the query, so you can finally do… MyModel::doSomethingRandom($requestOrWhatever)->where(…)->get(); Hope this […]

+ Leer más

Prevent xmlrpc WordPress attack

I was facing an issue with one of my WordPress sites. Suddenly my server went down, I receive a notification from JetPack saying your site is down and also, the database after an apache restart was down. I checked the server during this events and executing a top command showed me lots of httpd processes […]

+ Leer más