laravel 5.2 relation not working
<p>Laravel 5.2 installed using composer. I have 2 tables customers with id and name also orders with id, customer_id and name. Created 2 model Customer and Order.
Order model </p>

<pre><code>&lt;?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    //
    protected $table = 'orders';
    public function customer(){
        return $this-&gt;belongsTo('App\Customer'); 
    }
}
</code></pre>

<p>in the root file</p>

<pre><code>Route::get('orders',function(){
    $orders=App\Order::find(1);
    echo "&lt;pre&gt;";
    foreach($orders as $order){
        echo $order-&gt;name."Order by ".$order-&gt;customer-&gt;name."&lt;br /&gt;";
    }
});
</code></pre>

<p>It show error
Trying to get property of non-object</p>