rajcsanyiz

rajcsanyiz

Member Since 3 Years Ago

Zalaegerszeg

Web developer at Court of Zala County

Experience Points 14,180
Experience Level 3

820 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 178
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

14 Mar
4 months ago

rajcsanyiz left a reply on Query Builder + Where + Inner Select

Yep, the whereDate() expression and the where + DB::raw() expression was the solution:

Both code are work correctly now:

        $query = DB::table('tmteher_monthly_stats as tms')
            ->select('tms.user_id')
            ->addSelect('tms.dayoff')
            ->whereDate('tms.stat_date', '=', $period.'-01')
            ->where('tms.id', '=', function($query) {
                $query->from('tmteher_monthly_stats AS tms2')
                    ->selectRaw('max(tms2.id)')
                    ->whereRaw('tms2.user_id = tms.user_id')
                    ->whereRaw('tms2.stat_date = tms.stat_date');
            });
        $query = DB::table('tmteher_monthly_stats as tms')
            ->select('tms.user_id')
            ->addSelect('tms.dayoff')
            ->whereDate('tms.stat_date', '=', $period.'-01')
            ->where('tms.id', '=', function($query) {
                $query->select(DB::raw('max(tms2.id)'))
                    ->from('tmteher_monthly_stats AS tms2')
                    ->where('tms2.user_id', '=', DB::raw('tms.user_id'))
                    ->where('tms2.stat_date', '=', DB::raw('tms.stat_date'));
            });

Explanation:

The where expression don't use properly the apostrophes. The inner select's where without DB::raw() recognise the field as string.

rajcsanyiz left a reply on Query Builder + Where + Inner Select

It's work correctly:

        $query = DB::table('tmteher_monthly_stats as tms')
            ->select('tms.user_id')
            ->addSelect('tms.dayoff')
            ->addSelect('tms.sickpay')
            ->addSelect('tms.education')
            ->whereDate('tms.stat_date', '=', $period.'-01')
            ->where('tms.id', '=', function($query) {
                $query->from('tmteher_monthly_stats AS tms2')
                    ->selectRaw('max(tms2.id)')
                    ->whereRaw('tms2.user_id = tms.user_id')
                    ->whereRaw('tms2.stat_date = tms.stat_date');
            });

But I don't understand why doesn't work my pervious code.

rajcsanyiz left a reply on Query Builder + Where + Inner Select

@BORISU - I need this query to make a summary report. User can close a specific months multiple times. The first select gather the statistic data but sometimes exists data multiple times per users. I found a souliton bellow, but I don!t understand.

rajcsanyiz started a new conversation Query Builder + Where + Inner Select

I have a SQL query:

        SELECT tms.id,
                tms.user_id,
                tms.dayoff
               FROM tmteher_monthly_stats AS tms
              WHERE tms.stat_date = '2019-03-01'
                    AND tms.id = (
                    SELECT MAX(tms2.id)
                  FROM tmteher_monthly_stats AS tms2
                  WHERE tms2.user_id = tms.user_id
                    AND tms2.stat_date = tms.stat_date)
        */

I would like transform to eloquent query buildier:

```php
        $query = DB::table('tmteher_monthly_stats as tms')
            ->select('tms.user_id')
            ->addSelect('tms.dayoff')       
            ->where('tms.stat_date', '=', '"'.$period.'-01"')
            ->where('tms.id', '=', function($query) {
                $query->select(DB::raw('max(tms2.id)'))
                    ->from('tmteher_monthly_stats AS tms2')
                    ->where('tms2.user_id', '=', DB::raw('tms.user_id'))
                    ->where('tms2.stat_date', '=', DB::raw('tms.stat_date'));
            });

The builder make the correct SQL query, but the result is empty.

The inner select is not Ok, but I don't know the correct solution.

15 Oct
2 years ago

rajcsanyiz left a reply on Ubuntu With Laravel 5.x Tutorials Please

I agree with xHer.

I use Windows 10 + VirtualBox with Debian servers (Laravel 4.2, 5.1, 5.2, 5.3) in my company. My IDE are PHPStorm, SublimeText + SQLYog (in windows) But I use Ubuntu, Debian, Linux Mint too learn Jeffrey training, because the MacOS and Linux are more similar than Win10.

The debugging, preprocessing (sass, coffescript) much more easier in a single (simple) environment. I think a little cumbersome to setup Win10, virtualbox and debuging, but Win10 is not proper to develop native. (I think)

So https://serversforhackers.com/ is very good, but I'll happy somebody answer the next questions in some videos (not Jeffrey, because he use Mac)

Laravel in Windows/Linux PHPStorm in Linux PHPStorm in Windows Installing LAMP (Linux, Apache, MySQL, PHP) Installing LNMP (Linux, NginX, MySQL, PHP) Multiple PHP versions on Linux Multiple PHP versions on Windows (WAMP, MAMP, ...) Multiple Apache versions on Linux Multiple Apache versions on Windows Multiple NginX versions on Linux Multiple NginX versions on Windows Rights and permissions on Linux

Icing on the cake :) Install Laravel to Ubuntu Install Laravel on Debian Install laravel on Windows 10

(Sorry my poor English...)