Skip to content

Tag: php

Get properties of a pdf file by using PHP

I have on pdf document. I want to print the details of pdf like page size by using php. I have this code This is my code can any one help regarding this. Thanks in advance Answer First check your pdfinfo’s path, if you don’t have it: XPDF… so then change your code: If you use Linux: $pdfinfo…

Nest JSON from MySQL using PHP

I have a MySQL query which returns the following table: and I have to return, via PHP, a formatted JSON which looks like the following: Basically, I need to nest the invitations inside each event. Answer Try this.

PHP Split html string into array

I hope I can get some help from you guys. This is what I’m struggling with, I have a string of HTML that will look like this: I need to split all the <h4> from the rest of the content, but for example the content after the first <h4> and before the second <h4> needs to be related to th…

Cakephp Auth->user() null

In my CakePHP app, I want to include a login form on every page with a login button if the user is not logged in and a logout button if they are logged in. Here is my Auth configuration in AppController.php I want to set a flag that is usable in all the views to check if the user is

Laravel 5 how to get route action name?

I’m trying to get the current route action, but I’m not sure how to go about it. In Laravel 4 I was using Route::currentRouteAction() but now it’s a bit different. I’m trying to do Route::getActionName() in my controller but it keeps giving me method not found. Answer In Laravel 5 you …

Laravel belongsTo returning null when using ‘with’

I’m just getting started with Laravel so please forgive any noobness. I have a User and Order model, a user has many orders: So I think I have the above right. But when I do this: I get Call to a member function addEagerConstraints() on null. However, if I do it the other way around, it works great: Wha…

Use one Laravel migrations table per database

I work in a project that uses multiple databases. It seems like Laravel only uses the migrations-table in the database that is set as default. I would like one migrations table per database that logs the migrations that have been done to that specific database. Is this possible? I have defined the databases i…