can't access model in relations laravel

Solution 1:

change this:

public function Restaurant(){
    return $this->belongsTo(Restaurant::class);
}

to this;

public function Restaurant(){
    return $this->belongsTo(Restaurant::class, 'id_restaurant');
}

and similar,

public function Order(){
    return $this->belongsTo(Order::class);
}

to;

***(hasMany)

public function Order(){
    return $this->hasMany(Order::class, 'id_restaurant');
}

Solution 2:

You have to specify foreign key, just check documentation

https://laravel.com/docs/8.x/eloquent-relationships#one-to-many-inverse

Snippet from Laravel documentation.

However, if the foreign key for your relationship does not follow these conventions, you may pass a custom foreign key name as the second argument to the belongsTo method:

public function post()
{
    return $this->belongsTo(Post::class, 'foreign_key');
}

If your parent model does not use id as its primary key, or you wish to find the associated model using a different column, you may pass a third argument to the belongsTo method specifying your parent table's custom key:

/**
 * Get the post that owns the comment.
 */
public function post()
{
    return $this->belongsTo(Post::class, 'foreign_key', 'owner_key');
}