* [Define] modelos iniciales.
* [Establece] relaciones entre modelos.
This commit is contained in:
parent
64948e27db
commit
ecf4a7164b
9
app/Models/Company.php
Normal file
9
app/Models/Company.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Company extends Model {
|
||||
//
|
||||
}
|
9
app/Models/Price.php
Normal file
9
app/Models/Price.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Price extends Model {
|
||||
//
|
||||
}
|
14
app/Models/Student.php
Normal file
14
app/Models/Student.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Student extends Model {
|
||||
/**
|
||||
* Establece la relación Students-Company
|
||||
*/
|
||||
public function company() {
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
}
|
21
app/Models/Subscription.php
Normal file
21
app/Models/Subscription.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Subscription extends Model {
|
||||
/**
|
||||
* Establece la relación Subscriptions-Students
|
||||
*/
|
||||
public function student() {
|
||||
return $this->belongsTo(Student::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Establece la relación Subscriptions-Prices
|
||||
*/
|
||||
public function price() {
|
||||
return $this->belongsTo(Price::class);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue