In laravel 5.4 i have this issu

/home/vagrant/Code/building/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php

line 2508: Call to undefined method

Illuminate\Database\Query\Builder::id()
enter image description here

STORE METHOD IN THE BUILDING CONTROLLER

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\BuildingRequest;
use App\User;
use App\Building;
class BuildingController extends Controller

protected function store(BuildingRequest $request, Building $build)
{
    dd(User::id() );
}

RELATIONSHIP IN User.php

public function buildings()
{
    return $this->hasMany('App\Building');
}

RELATIONSHIP IN Building.php

public function user()
{
    return $this->belongsTo('App\USER');
}

NOTE THAT ANY ONE CAN STORE A BUILDING WITHOUT BEING A USER

Hi,

do you mean like this dd( Auth::User()->id ) ?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.