GroundZero

Experience

1,160

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 7 Lessons Completed
  • 0 Favorites

18th July, 2017

GroundZero left a reply on SQLSTATE[22007]: Invalid Datetime Format • 1 week ago

Problem is fixed. I was inserting/updating a Productnumber e.g. 15000 but for some reason Laraval kept changing it to 15000.0 so I had to type cast it with (string) and that fixed it.

Strange that Laravel is changing the stuff I put into a query but oh well... now I know for future reference :)

Thanks for your reply lars6!

17th July, 2017

GroundZero started a new conversation SQLSTATE[22007]: Invalid Datetime Format • 1 week ago

Ha guys,

I am stuck on this error. I changed my code a little bit (more fields to save) and all the sudden I would end up with this error.

I fetch my ProductNUmber for example "1500002" which is the correct one, and then I try to update it with this code:

$amount = Products::where('ProductNumber', $productNumber)->update( $update );

Always worked untill I added more fields. I have no clue what could be wrong... been looking and trying for hours but somehow the code crashes (this error) when it reaches this rule ($amount)

SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'BB001' (SQL: update `Products` set `BrandID` = 10, `itemName` = "Cosmopolis", `ItemNameSub` = "", `EAN` = "7612718346184", `WatchMovementPartNrID` = 2313, `CaseCode` = "", `StraightStrapMount` = 0, `Diameter` = 0 where `ProductNumber` = 1500002)

The contents of $update are:

(
    [BrandID] => 10
    [itemName] => Cosmopolis
    [ItemNameSub] =>  
    [EAN] => "7612718346184"
    [WatchMovementPartNrID] => 2313
    [CaseCode] => 
    [StraightStrapMount] => 0
    [Diameter] => 0
) ```

Hope someone can shine a light on this problem haha.


12th July, 2017

GroundZero left a reply on Updates Not Visible Until Artisan View:clear • 2 weeks ago

OPcache is disabled on there server where I am hosting :) I think the modification time is updated because sometimes I see an error about mkfiletime or something like that (forgot the php function name) when I refresh to fast after doing a

php artisan view:clear

so yeah that one if being updated as far as I know :)

Weird part is... today I was developing a little bit, and the whole time I did NOT need to run a clear command... while all the previous days I had to :/

But that might be luck, I bet tonight when I continue development I have to clear again hahaha :P

11th July, 2017

GroundZero left a reply on Route File With Database Request • 2 weeks ago

ah that is exactly what I needed haha, thanks so much for your answer bunnypro!

GroundZero left a reply on Route File With Database Request • 2 weeks ago

I get your point mushood, except in this case the "SEO experts" have chosen to keep the deepness of the URL short e.g. no prefix, which I personally would prefer (product, brand, et cetera).

I am totally not familiar with polymorphic relations et cetera mikevrind but I will surely check out the link.

Thank you both for your answers and suggestions!

GroundZero started a new conversation Route File With Database Request • 2 weeks ago

Hi,

I was wondering if this is possible or not, and if yes how to do it. Short explanation:

url possibility 1: www.mysite.com/intel/ url possibility 2 www.mysite.com/amd-ryzen-7-1800x/

The first one is a "brand" page and the second one a "product page". I dislike the use of regex because I honestly do not like .htm at the end e.g.

www.mysite.com/amd-ryzen-7-1800x.htm

to define if it is a product page or not. Is there any other way to do this? e.g. in the routes file check what is searched for (number of rows from a mysql request e.g. the one below) and then display the correct route?

Hope someone can help me out with this :)


if num_rows == 0

SELECT id FROM Pages WHERE pageName= "amd-ryzen-7-1800x"```

et cetera, untill I found what was looked for, if no results then a 404 page or what ever I decide to use :)

10th July, 2017

GroundZero left a reply on Updates Not Visible Until Artisan View:clear • 2 weeks ago

Unfortunately I have no admin or anything (Seeing your Dutch just like me, I think you will know this company.. PCEXTREME).

I tried like literally 30+ tutorials on internet but none work and -or help me to disable the view cache. Either they do nothing or I get errors lol.

So yeah, hope someone else knows a fix ^^

9th July, 2017

GroundZero left a reply on Updates Not Visible Until Artisan View:clear • 2 weeks ago

Found the solution myself ;)

Need to use the cache facade in the controller and then flush it.

use Illuminate\Support\Facades\Cache; Cache::flush();

thats all :)

GroundZero started a new conversation Updates Not Visible Until Artisan View:clear • 2 weeks ago

Ha guys,

quick question... anything I update in my website is NOT visible untill I run the command:

artisan view:clear

through SSH... is there a way for me not to having to run this command non-stop? its really annoying haha...

GroundZero left a reply on CSS BG Image Not Found, But Found When Clicked On Link • 2 weeks ago

I put it on a new domain, so you can see a live version :)

http://bit.ly/2tVJfgo

same stuff happens. Its not shared hosting, I have not changed .htaccess files or anything else. When I use placeholders from an external source, everything is already... only when using images from my local hosting they can not be displayed... this only happens in Laravel.

8th July, 2017

GroundZero left a reply on CSS BG Image Not Found, But Found When Clicked On Link • 2 weeks ago

well, dont think that is the issue... I have multiple sites on my domain (not shared hosting) and it works flawless, has been for 13+ years... only since this week with Laravel I had this issue (im new to Laravel)... so I think its either Laravel or something like that related cause everything else is working just fine :)

Thanks for your fast replies!

GroundZero left a reply on CSS BG Image Not Found, But Found When Clicked On Link • 2 weeks ago

At the bottom increases the page load speed, been doing it for years ;) but for this example ill move it to the top then :)

About the public folder... I meant the "public" folder in Laravel. After deploying it, it automaticly comes as

root\public\index.php

and thus to see the website I need to go to www.mysite.nl/public/ otherwise I wont see anything. See my folder structure in the screenshot. This is how Laravel comes out of the box.

See the link below for my FTP folder structure. I have no clue on how or what to change in the .htaccess to make everything visible without typing in "public" in the URL.

/domains/mysite.nl/htdocs/www/projects/zoekmachine

image: https://s11.postimg.org/wb2zazcqr/laravel.jpg

GroundZero left a reply on CSS BG Image Not Found, But Found When Clicked On Link • 2 weeks ago

yeah correct but that shouldnt matter, works both ways but I tried both and both gave the same outcome unfortunately :(

GroundZero started a new conversation CSS BG Image Not Found, But Found When Clicked On Link • 2 weeks ago

Hi guys, as the title says...

when I use background-image:url('') it says the image is not found but when I click on the image link in the source code, it shows me the image.

Can anyone explain me what is wrong?

Also... to see my website I have to go to www.mysite.com/public and when I try the .htaccess method found on internet

RewriteEngine On RewriteRule ^(.*)$ public/$1 [L]

it doesnt work, it gives me a route error.

Hope someone can help me out, i'm using Laravel 5.4 :)

26th June, 2017

GroundZero left a reply on Query With Dynamic Amount Of Joins • 1 month ago

Thanks for your answer. I will look into that :)

23rd June, 2017

GroundZero started a new conversation Query With Dynamic Amount Of Joins • 1 month ago

Ha guys,

I have a unknown (1 up to 4) amount of joins that I would like to add to my query. Unfortunately, no matter what I do, the query ignores my join. No error, nothing. Can someone please help me out and tell me how to get this working?

// create a new query object
$products = new Products;

// create selects and joins
foreach($fields as $field){
    switch($field){
        case 'ProductNumber':
            $select[] = 'ProductNumber';
        break;

        case 'EAN':
            $select[] = 'EAN';
        break;

        case 'caseCode':
            $select[] = 'WatchCaseColorID';
        break;

        case 'diameterCase':
            $select[] = 'Diameter';
        break;

        case 'straightStrapMount':
            $select[] = 'StraightStrapMount';
        break;

        case 'strapFamily':
                $products->join('watchStrapLinking', 'Products.id', '=', 'watchStrapLinking.watchProductId', 'inner');
            $joins[] = 'watchStrapLinking';
        break;

        case 'diameterStrap':
            $products->join('Products', 'Products.id', '=', 'watchStrapLinking.strapProductId', 'innert');
            $joins[] = 'Products';
        break;

    }
}




DB::connection()->enableQueryLog();

$products->select($select)->limit(1)->get();
$products->join('a', 'a.a', '=', 'b.b', 'inner');

$queries = DB::getQueryLog();

echo '<pre><code>'.print_r($queries, true).'</code></pre>';
echo '<pre><code>'.print_r($products[0], true).'</code></pre>';
echo '<pre><code>'.print_r($select, true).'</code></pre>';
echo '<pre><code>'.print_r($joins, true).'</code></pre>';

the select is working properly obvious, but the JOINS are just totally ignored.

Hope someone can help me out!

Best regards

7th February, 2017

GroundZero left a reply on SUM And GroupBy Problems / Guiding • 5 months ago

I have just found the answer after hours of searching. I am a total noob and still learning Laravel so yeah ^^

Anyways the answer to my problem:

open the database.php file in /config/database.php and find your database connection. It should have a line saying "strict". Standard this is set to "true" which forces you to parse all row names.

When set to "false" you can use groupBy with just one row name i.e:

'strict' => false,

Hope this will help out others as well when they encounter this "problem".

Thanks

GroundZero started a new conversation SUM And GroupBy Problems / Guiding • 5 months ago

Ha guys,

I am currently learning Eloquent but I am having trouble forming my query properly. What I want to archieve is:

Get ALL results but group on "url" and count each value togather from "page_load_time" and "pagespeed_score" field.

So basicly I have this date:

[ id ][ page_load_time ][ pagespeed_score ][ url ] 1 0.214 9.2 mysite.it/mypage/ 2 0.321 8.9 mysite.it/mypage/

and it should become this:

[ id ][ page_load_time ][ pagespeed_score ][ url ] 1 0.535 18.1 mysite.it/mypage/

My current query is:

$data = Rapports::select('id', DB::raw('SUM(page_load_time) as pltt'), 'uri', DB::raw('SUM(pagespeed_score) as pst'), 'execution_date') ->orderBy('id', 'desc') ->where('execution_date', '>=', date("Y", time()).'-'.date("m", time()).'-01') ->whereIn('uri', $arr) ->groupBy('id', 'uri', 'page_load_time', 'pagespeed_score', 'execution_date') ->get();

Hope someone can give me the right answer :)

Your sincerely,

Mithradantor

22nd November, 2016

GroundZero started a new conversation Laravel 5.X Cookbook And Current Version • 8 months ago

Hello,

I have a simple question and I was hoping someone could give me an answer too it :)

I was thinking about buying this book at bol.com @ https://www.bol.com/nl/p/laravel-5-x-cookbook/9200000058438105/

I saw that the routes have changed in Laravel 5.3, is this also in the book or is the book still following the "older" way?

I am totally new to Laravel so I would prefer a book that handles Laravel exactly as the current version 5.3 is as of today so I do not have to go back and forward to the internet because things are not as if written in the book.

Hope someone can give me an answer on this matter :)

Thanks in forward,

Yours sincerely,

Angelo

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.