jeudi 1 septembre 2016

Laravel 5 Eloquent: How to get raw sql that is being executed? (with binded data)

Im trying to figure out how to get the raw sql query being executed including the binded data in it. Here is what ive got:

\DB::connection()->enableQueryLog();
$query = \DB::getQueryLog();
$lastQuery = end($query);

And here is what the result looks like:

array(3) {
  ["query"]=>
  string(57) "select * from `table_1` where `field_1` = ? limit 1"
  ["bindings"]=>
  array(1) {
    [0]=>
    string(34) "xyz"
  }
}

So how do I get a dump of a full sql query like this?

select * from `table_1` where `field_1` = 'xyz' limit 1

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2c3eZav
via IFTTT

Returning values from DB laravel 5

Hey guys I have this: $fetchedUser = DB::table('users')->where('first_nome', $nome)->get(); $f_nome = $fetchedUser->first_nome; return ($f_nome);

I want to return the a name and maybe some other data of the fetched user. But I get an error of "Trying to get property of non-object"

So I did this: $fetchedUser = DB::table('users')->where('first_nome', $nome)->get(); return ($fetchedUser);

And I get a long array with the fetched user's info from the DB..

So my question is this, how do i return $nome only?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bEwWYQ
via IFTTT

Is it possible to send emails programmatically to a PHPList list?

I am looking for a solution to send automated emails from my website to PHPList lists. From my understanding, PHPList's emails are authored manually using the web-based interface provided by the application. Are there some APIs I can use to allow my website to send emails directly?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bEcrRR
via IFTTT

multiple values next to in a list

I created a tool, which is making a statistic and other things about Scuderia Ferrari.

At the moment I am working on the statistic part for wins, pole positions, podiums and so on.

About my mysql query I am counting how many wins, poles and so on at single grand prixs have been reached by the drivers.

At the moment the results will sorted in a list by successively.

My target is, if two drivers or more have the same result to write them next to each other in the list.

How I can reach this?

list design at the moment target for list design



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ct077i
via IFTTT

Laravel 5.2 Localization , attributes nog showing up when switching language

Using Laravel 5.2.41

Using following translation package: mcamara/laravel-localization

Link inside my view :

<a href=""> Edit Link</a>

routes.php files inside Lang/fr & Lang/nl

<?php
return [
    'account-edit'      => "account/wijzig-gegevens/{id}", 
];

<?php
return [
    'account-edit'      => "donnees/modifier-donnees/{id}", 
];

Laravel routes file:

 Route::group([

    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => ['localize','localeSessionRedirect', 'localizationRedirect' ]

    ], function()
    {

Route::get(LaravelLocalization::transRoute('routes.account-edit'),'AccountController@edit');

});

When i look at the link in my default language (nl) i get the correct link like so:

<a href="http://ift.tt/2bFwUmv">Edit Link</a>

But when i change my language to french i get following link:

<a href="http://ift.tt/2bKmZth}">Edit Link</a>

Can't figure out why this is happening



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bFwInj
via IFTTT

PHANTOMJS PHP : Empty response object

When I try to save the file locally, the response object is returned null .The page I'm trying to capture takes a lot of loading time for which I need a callback to notify me when all page resources are completely loaded. Is my approach correct ?

When not trying to save the file locally the response object returned is not null.

Here's my code:

$client = Client::getInstance();
$client->getEngine()->setPath('path/to/phantomjs');
    $client->isLazy();

    $request  = $client->getMessageFactory()->createPdfRequest('http://google.com');
    $response = $client->getMessageFactory()->createResponse();

    $file = 'path/binfile.pdf';

    $request->setOutputFile($file);

    $client->send($request, $response);

How do I achieve and know when all the page resources are completely loaded ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bJYTPn
via IFTTT

htaccess browser caching not working : Laravel

I have checked on google page speed which is showing 48/100 and after implementing cache in htaccess, page speed is same.Please tell if i need to add something else in this file or other files to implement cache.

.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        <FilesMatch "\\.(js|css|woff|woff2)$">
    Header set Cache-Control "max-age=604800, public"
        </FilesMatch>

</IfModule>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bJWtAl
via IFTTT