Skip to content

Commit

Permalink
modely
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiří Lýsek committed Feb 22, 2017
1 parent 8beb35d commit 5afa185
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/Models/Location.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Location extends Model
{

public function persons()
{
return $this->hasMany('App\Models\Person', 'id_location');
}

}
17 changes: 17 additions & 0 deletions app/Models/Person.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Person extends Model
{

protected $table = "persons";

public function location()
{
return $this->belongsTo('App\Models\Location', 'id_location');
}

}

0 comments on commit 5afa185

Please sign in to comment.