nadj

nadj

Member Since 3 Years Ago

Subotica

IT at Subotica Tech

Experience Points 36,460
Experience Level 8

3,540 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 355
Lessons
Completed
Best Reply Awards 1
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.

05 Oct
5 months ago

nadj left a reply on Strange Query Problem

I have it enabled from cli too. The version is 5.7.22

Server version: 5.7.22-0ubuntu18.04.1 (Ubuntu)
mysql> SELECT @@sql_mode;
--------------
SELECT @@sql_mode
--------------

+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode                                                                                                                                |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+

And when I run this query:

mysql> select `c`.`id`, `c`.`lat`, `c`.`lng`, `ct`.`name`, `ct`.`slug`, count(sj.student_id) as student_count from `cities` as `c` inner join `city_translations` as `ct` on `ct`.`city_id` = `c`.`id` inner join `companies` as `comp` on `comp`.`city_id` = `c`.`id` inner join `student_jobs` as `sj` on `sj`.`company_id` = `comp`.`id` inner join `students` as `s` on `s`.`id` = `sj`.`student_id` where `ct`.`locale` = 'sr' and `s`.`active` = 1 group by `c`.`id`;
--------------
select `c`.`id`, `c`.`lat`, `c`.`lng`, `ct`.`name`, `ct`.`slug`, count(sj.student_id) as student_count from `cities` as `c` inner join `city_translations` as `ct` on `ct`.`city_id` = `c`.`id` inner join `companies` as `comp` on `comp`.`city_id` = `c`.`id` inner join `student_jobs` as `sj` on `sj`.`company_id` = `comp`.`id` inner join `students` as `s` on `s`.`id` = `sj`.`student_id` where `ct`.`locale` = 'sr' and `s`.`active` = 1 group by `c`.`id`
--------------

+----+-------------+---------------+-------------------+-------------------+---------------+
| id | lat         | lng           | name              | slug              | student_count |
+----+-------------+---------------+-------------------+-------------------+---------------+
|  1 | 37.40930700 | -116.83705300 | sr-Schummmouth    | sr-schummmouth    |             2 |
|  3 | -5.65479800 |  141.62207800 | sr-New Jon        | sr-new-jon        |             1 |
|  5 | 12.83302800 | -138.16928200 | sr-East Bryanaton | sr-east-bryanaton |             1 |
+----+-------------+---------------+-------------------+-------------------+---------------+
3 rows in set (0.00 sec)


It works with only group by c.id from laravel I must add the other 2 columns to the group by when 'strict'=>true

nadj left a reply on Strange Query Problem

When I set 'strict' => false works fine I just don't understand what added the additional aggregate exception while ONLY_FULL_GROUP_BY is enabled on my server by default.

nadj left a reply on Strange Query Problem

Yes but the ONLY_FULL_GROUP_BY is enabled in mysql by default now. Some of the other modes are having an impact on this too?

Thanks

nadj started a new conversation Strange Query Problem

Hi all, i have a very strange problem.

I'm joining tables with this query:

$studentsCount = DB::table('cities as c')
            ->select('c.id', 'c.lat', 'c.lng', 'ct.name', 'ct.slug', DB::raw('count(sj.student_id) as student_count'))
            ->join('city_translations as ct', 'ct.city_id', '=', 'c.id')
            ->join('companies as comp', 'comp.city_id', '=', 'c.id')
            ->join('student_jobs as sj', 'sj.company_id', '=', 'comp.id')
            ->join('students as s', 's.id', '=', 'sj.student_id')
            ->where('ct.locale', $locale)
            ->where('s.active', 1)
            ->groupBy('c.id')
            ->get();

When I run that query from MySQL workbench it works fine no aggregate error. Also tried to run it from cli on Homestead where MySQL workbench is connecting.

The aggregate error appears when I use that query in laravel:

Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'alumni.ct.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select `c`.`id`, `c`.`lat`, `c`.`lng`, `ct`.`name`, `ct`.`slug`, count(sj.student_id) as student_count from `cities` as `c` inner join `city_translations` as `ct` on `ct`.`city_id` = `c`.`id` inner join `companies` as `comp` on `comp`.`city_id` = `c`.`id` inner join `student_jobs` as `sj` on `sj`.`company_id` = `comp`.`id` inner join `students` as `s` on `s`.`id` = `sj`.`student_id` where `ct`.`locale` = sr and `s`.`active` = 1 group by `c`.`id`) in file /home/vagrant/projects/vts-alumni/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 664
Stack trace:

When I add the nonaggregated fields to the query this way:

->groupBy('c.id', 'ct.name', 'ct.slug')

It works.

I don't understand how the error is not appearing from mysql cli and workbench but appearing from laravel. Laravel is connecting to the same mysql server where I run my tests from cli and workbench.

10 Sep
6 months ago

nadj left a reply on Autoload.php Fail

My index.php looks different there is no require __DIR__.'/../vendor/autoload.php'; in mine

<?php

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';


$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

nadj left a reply on Autoload.php Fail

Can you please post your public/index.php here?

nadj left a reply on Autoload.php Fail

It worked? @Webiondev123

07 Sep
6 months ago

nadj left a reply on Autoload.php Fail

Then the path in your index.php is not right. Look at the line 24 now it reads: C:\wamp\www\fundtheneedy/../vendor/autoload.php I think it should be: C:\wamp\www\fundtheneedy/vendor/autoload.php

nadj left a reply on Autoload.php Fail

@Webiondev123 where is your vendor folder? Is it in C:\wamp\www\ or in C:\wamp\www\fundtheneedy ?

nadj left a reply on Autoload.php Fail

I think you need to run

composer dump autoload

to refresh the paths.

08 Mar
1 year ago

nadj started a new conversation Passport Advice Needed - Consuming My Own API

Hello, I'm working on a students alumni project.

I made an API that I consume on the back-end, using Laravel Passport, vue and axios it all works and looks wonderful.

Now I want to be able to send invites to students, so they can fill the required data themselves.

Workflow: When the student click on a link from my email he can create his profile and after saving it he can't edit it again.

Problem: My problem is with my API, how to give access to students who have this invites?

My thinking about the solution: I thought to create one user in my Laravel app called Invites, generate a token for that user and consume my API with it, but the problem is that once someone has the token he can create data as many times he wants.

Should I tie a different user to every invite and consume my API with that token and make it invalid after?

Any advice will be highly appreciated.

Thanks in advance.

24 Jan
1 year ago

nadj left a reply on How To Show Only Threads Of Certain Category When I Click On Category Name

I think that almost everything you need is described in this video:

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/11

if not, look around in that series. It's really good and full of good advice.

nadj left a reply on Current Week

If you want just a current week of the year

$now = Carbon::now();
echo $now->weekOfYear;

If you want to get a record from the database look at this thread:

https://laracasts.com/discuss/channels/eloquent/model-groupby-weeks?page=1#reply-155982

22 Jan
1 year ago

nadj left a reply on Get Array Value

Try it like this:

@foreach ($admins as $key => $admin) 
    {{ ucfirst($admin->display_name ) }}
@endforeach 

nadj left a reply on Multi Language In Laravel

Hi @usamamuneer , for the data that needs to be stored in the database in different languages I'm using this package: https://github.com/dimsav/laravel-translatable it works quite well.

For the static translations laravel uses language files, and there are helpers in the view for it like @lang() or __(). More info here: https://laravel.com/docs/5.5/localization

18 Jan
1 year ago

nadj left a reply on Deploying Laravel On Ubuntu Server

The web server default user (it's www-data most of the time), should have execute rights on php files.

nadj left a reply on Laravel Itterate Through Arrays In An Array

Check what is in $items variable in the first foreach.

@foreach($data as $items)
    dd($items);
        @if($items)
                @foreach($items as $subitem)
                    {{ dd($subitem) }}
                @endforeach
        @endif
    @endforeach 
17 Jan
1 year ago

nadj left a reply on Laravel Itterate Through Arrays In An Array

Maybe a nested foreach?

foreach($apiResponse as $items) {
    if(is_array($items) {
        foreach($apiResponse as $items as $subitem) {
            dd($subitem);
        }
    }
}
30 Sep
1 year ago

nadj left a reply on WhereBetween() Eloquent Returning Wrong Results

@eddy1992 can you try to make it a decimal, int or something that fits your data? The WHERE BETWEEN acts differently for string and numeric columns.

29 Sep
1 year ago

nadj left a reply on WhereBetween() Eloquent Returning Wrong Results

What is the type of your km column?

27 Sep
1 year ago

nadj left a reply on TokenMismatchException In VerifyCsrfToken.php (line 68) In Laravel 5.4

@kamran186 you can check the source for _token hidden element value. After go to app_dir/storage/framework/sessions/your_session_name_from_cookie

The same _token value should appear there.

a:3:{s:6:"_token";s:40:"ZSw2YUlJAj1vQ5XMOiz1OIFkhgA6pUU6spR1DNgo";s:9:"_previous";a:1:{s:3:"url";s:14:"http://vts.app";}s:6:"_flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}

If it's not the same, or you have no session files there, check the permissions on the sessions folder

26 Sep
1 year ago

nadj left a reply on TokenMismatchException In VerifyCsrfToken.php (line 68) In Laravel 5.4

Hi, I had a similar problem before. Check your session, if the session is not working as it should the token is not saved there and this exception happens.

05 Mar
2 years ago

nadj left a reply on Get Parameter With + Sign

Thank you, it comes from an external API, I will ask them to encode.

nadj started a new conversation Get Parameter With + Sign

Hi everyone. I have a problem with a parameter passed to a controller. My url looks like this:

http://ic.app/verify-email?key=0000533aA4iNwtG55g16EJj3&email=googleacc+1@gmail.com

in the controller the email param gets recieved:

$request->input('email')

but it becomes:

googleacc 1@gmail.com

The + sign is decoded to a space. Is there any way to receive it as is?