关系不正常

I'm currently following an online course on Laravel and I'm stuck at some relations. I've been looking for a bug last 3 hours and I'm unable to find it.

Basically, I have a form which user fills in, and a field where he loads a picture. For that picture I have two separate tables in database (photos - contains info about that photo & users - where photo_id should go). I followed all the steps in the course, but upon inserting picture in my database, relation doesn't work properly. I'll provide all the code I have down below.

User-Photo relation:

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

Saving form data in database and creating a picture in controller:

public function store(UsersRequest $request)
{
    $input = $request->all();

    if ($file = $request->file('photo_id')){

        $name = time().$file->getClientOriginalName();
        $file->move('images', $name);
        $photo = Photo::create(['file'=>$name]);
        $input['photo_id'] = $photo->id;
    }

    $input['password'] = bcrypt($request->password);
    User::create($input);

    return redirect('/admin/users');
}

This is my form input field for a picture:

<div class="form-group">
    {!! Form::label('photo_id','Photo: ') !!}
    {!! Form::file('photo_id', null , ['class'=>'form-control']) !!}
</div>

This code gives me no error whatsoever, but my relations don't work properly. Photos table doesn't get filled with any data, and in my Users table, column photo_id gets filled with a photo name, not an id as it should.

I'd really appreciate any help here. If I forgot to provide anything else here, please let me know.

Like Chung Nguyễn Trần I assume that the file upload isn't working properly.

Common mistake here is that the form was not opened with 'files' => true. See also in the docs: https://laravelcollective.com/docs/5.2/html#file-input

So you should do:

echo Form::open(['url' => 'foo/bar', 'files' => true]);

From what you say, the Photo model should contain:

public function user()
{
    return $this->belongsTo(User::class)
}

The User model should contain:

public function photo()
{
    return $this->hasOne(Photo::class);
    // Or maybe this should be photos() and
    //return $this->hasMany(Photo::class);
} 

A common gotcha with relationships is making sure the id fields are correct, eg: photos table has a user_id field

And when getting to grips with how relationships work, I'd recommended working with 'artisan tinker' so you can check these simply in isolation to the rest of the code.