grigelionis

grigelionis

Member Since 3 Months Ago

Experience Points 190
Experience Level 1

4,810 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 May
3 days ago

grigelionis left a reply on Laravel Query Builder - How To Select Pairs Of Items?

@PUNKSOLID - Thanks for the prompt answer.

Sorry for unclearness of question. I want to retrieve two results for each domain.

Backing to my example above, there will be 7 results:

two for domain - example.com, two for oranges.com, two for apples.com and one for crocs.com

grigelionis started a new conversation Laravel Query Builder - How To Select Pairs Of Items?

Hi guys, I will try to explain what i want to achieve by simple example.

I have one table with following data:

id, domain, clicks, url 1, example.com, 54, http://example.com/link1 2, oranges.com, 13, http://oranges.com/link1 3, example.com, 10, http://example.com/link2 4, apples.com, 3, http://apples.com/link1 5, apples.com, 7, http://apples.com/link2 6, crocs.com, 10, http://crocs.com/link1 7, oranges.com, 88, http://oranges.com/link2 8, example.com, 12, http://example.com/link3 9, example.com, 7, http://example.com/link4 10, apples.com, 9, http://apples.com/link3 ......

My aim is to select pairs (two or one) of domains who have most clicks. So after querying the results of above (example) table could look following:

results, selected ids: 1, 8 (<-- example.com) 2, 7 (<-- oranges.com) 5, 10 (<-- apples.com) 6 (<-- crocs.com)

How to do that with Laravel Query Builder? Or it will need to manipulation in plain php level at controller?

Thanks!

24 Jan
3 months ago

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@CIPSAS - Guys, i found the problem... and the problem was really not in Laravel stuff. I tail'ed my server's access log and started waiting for the hit number while firing it from browsers url field.

And ... wolla, ugly, ugly little mistake in header.blade.php like this <link rel="icon" href="favicon.ico">

leaded to this:

Thanks for all for support, and sorry for your time! :(

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@VILFAGO - > is the result when you have @include('frontend/header', ['page_title' => 'hello' ]) ? So a +2 in the db ?

yes :D , i am shocked also, i don't get it.

But while writing this answer i've tried curl {url to page/method} and it seems that with curl everything is working fine.

So it must be something with doubling a request when typing url to browser. But while i am in Chrome network tab - i see single GET request with Status Code: 200 OK

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@VILFAGO - Hey, just installed debugbar. This is query results, nothing suspicious, just single update row.

View post on imgur.com

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@VILFAGO - I've also noticed that if i am just taking this part (located at article.blade.php)

@include('frontend/header', ['page_title' => $article_title ])

and leaving just

@include('frontend/header')

Then it increments as it should (by +1), but if i even do following:

@include('frontend/header', ['page_title' => 'hello' ])

Same problem persists.

p.s. yes sure, i will get back to this soon, installing debugbar now. Will write my observations down here.

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@CIPSAS - Nope, no view composer. Will try out debugbar. Thanks.

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@VILFAGO - > Or from the left or right block ? I've removed left/right blocks, from controller and views, same, increment firing twice.

have you a event and a listener to increment number of view ? I am quite green in such cases - no, i don't have any

grigelionis left a reply on Passing Variable To Blade Causes Increment() To Increment DB Field Twice

@VILFAGO - hitCollector is called through simple url (e.g. domain.com/article/45/article-about-cats)

Route::get('/article/{article_id}/{slug}', '[email protected]');

grigelionis started a new conversation Passing Variable To Blade Causes Increment() To Increment DB Field Twice

In my Blade file article.blade.php I include another view with a variable.

Blade @include('frontend/header', ['page_title' => 'hello' ])

Controller

{
    $data["article"] = DB::table('selected_articles')
        ->where('published', 1)
        ->where('id', $article_id)
        ->get();

    //collecting hit
    DB::table('selected_articles')
        ->where('id', $article_id)
        ->increment('clicks');

    return view('frontend/article', $data);
}```

As a result, I am getting DB field 'clicks' increased twice (+2) but not (+1) for given records. I noticed that doubling stops only if I am removing the ['page_title' => 'hello'] part from my Blade inclusion line.

Any ideas? Bug?