Another best way to achieve same is : $result = DB::connection() ->table(‘destinations AS d1’) ->select(array(‘d1.title AS level1’, ‘d2.title AS level2’)) ->leftJoin(‘taxonomy AS t1’, function($join) { $join->on(‘t1.parent_id’, ‘=’, ‘d1.id’); $join->where(‘t1.parent_type’, ‘=’, ‘Destination’); }) ->leftJoin(‘destinations AS d2’, ‘d2.id’, ‘=’, ‘t1.child_id’) ->where(‘d1.slug’, ‘=’, $slug) ->get(); Replace your on with where
How do I pass command line arguments to a Node.js program?
Standard Method (no library) The arguments are stored in process.argv Here are the node docs on handling command line args: process.argv is an array containing the command line arguments. The first element will be ‘node’, the second element will be the name of the JavaScript file. The next elements will […]
How to ignore invalid SSL certificate errors in Guzzle 5
You should use $this->client = new GuzzleClient([‘defaults’ => [ ‘verify’ => false ]]); i.e. a Boolean false, not the string ‘false’
Github create empty branch
What’s wrong with the —orphan option? If you want a branch that is empty and have no history, this is the way to go… git checkout —orphan empty-branch Then you can remove all the files you’ll have in the staging area (so that they don’t get committed): git rm -rf […]
Use Laravel without global scopes
6 If you want to explicitly avoid a global scope for a given query, you may use the withoutGlobalScope() method. The method accepts the class name of the global scope as its only argument. $ingredient->withoutGlobalScope(LocaleScope::class)->touch(); $ingredient->withoutGlobalScopes()->touch(); Since you’re not calling touch() directly, in your case it will require a bit […]
How to capture job queue details after completion in Laravel
Queue::after(function (JobProcessed $event) { $command = unserialize($event->data[‘data’][‘command’]); });
How can I change the default landing page for the Keycloak cartridge?
You can create a welcome theme that overrides the welcome-page. First create the theme in: /standalone/configuration/themes/welcome/<theme name> Then configure which theme to use in keycloak-server.json: { «theme»: { «welcomeTheme»: «<theme name>» } }
How to specify the private SSH-key to use when executing shell command on Git
Something like this should work (suggested by orip): ssh-agent bash -c ‘ssh-add /somewhere/yourkey; git clone [email protected]:user/project.git’ if you prefer subshells, you could try the following (though it is more fragile): ssh-agent $(ssh-add /somewhere/yourkey; git clone [email protected]:user/project.git) Git will invoke SSH which will find its agent by environment variable; this will, […]
How to disable welcome-root / welcome content in wildfly
1. Open your standalone.xml file and head to the undertow subsystem near the bottom of the file. 2. Delete the host mapper that maps requests to «/» to the «welcome-content» handler: <server name=»default-server»> <host name=»default-host» alias=»localhost»> <location name=»/» handler=»welcome-content»/> <!— Delete this line! —> </host> </server> 3. Delete the welcome-content […]
How to remove a polymorphic relation in Eloquent?
$posts->photos() is the relationship query to return all of the photos for a post. If you call delete() on that, it will delete all of those records. If you only want to delete a specific record, you need to make sure you only call delete on the one you want to delete. For […]