Laravel 5.2关系一对一查询

How i do the query to works like this example:$model->model2->attribute

<div class="form-group">
                {!! Form::label('Route name') !!}
                {!! Form::text('name', ( isset($climb->route->name) ? $climb->route->name : null ), array('class'=>'form-control' )) !!}
            </div>

You could try using your model in the view as in a dictionary, add something like this in your controller.

$model = Model::find($id);
$model['model2'] = $model->model2;
return view('your_view', ['model' => $model]);

For this I assume you already prepared your relationship in your model, doing that for your real models should make the view work this way

<div class="form-group">
    {!! Form::label('Route name') !!}
    {!! Form::text('name', ( isset($climb['route']['name']) ? $climb['route']['name'] : null ), array('class'=>'form-control' )) !!}
</div>

Create a relation:

Having:

class Comment extends Model
{
    /**
     * Get the post that owns the comment.
     */
    public function post()
    {
        return $this->belongsTo('App\Post');

Then thou shall call lika:

$comment = App\Comment::find(1);

echo $comment->post->title;

https://laravel.com/docs/5.2/eloquent-relationships#one-to-many

It's one many, not one one I think