Reshad
Reshad

Reputation: 2652

Laravel function returns null

I have made a function to use within my Laravel project.

    $user = Auth::user();

    $customer = DB::table('customer')
    ->where('email', $user->mail)
    ->get();

    die($customer);

But somehow the $customer stays empty all the time.

Every other query I made so far works except this one. I tried to replace get() with first() but no result. with get() the only thing I get is an empty array. What am I doing wrong?

Upvotes: 0

Views: 93

Answers (1)

Anam
Anam

Reputation: 12169

Replace the following line:

die($customer);

to

dd($customer);

dd means die and dump. In your code, you are not dumping object.

Upvotes: 1

Related Questions