diff --git a/paragonik-backend/app/Models/Category.php b/paragonik-backend/app/Models/Category.php new file mode 100644 index 0000000..ac18264 --- /dev/null +++ b/paragonik-backend/app/Models/Category.php @@ -0,0 +1,18 @@ +belongsTo('App\Models\ReceiptItem'); + } + + public function services() + { + return $this->belongsToMany('App\Models\Service', 'categories_services'); + } +} diff --git a/paragonik-backend/app/Models/Receipt.php b/paragonik-backend/app/Models/Receipt.php new file mode 100644 index 0000000..a465184 --- /dev/null +++ b/paragonik-backend/app/Models/Receipt.php @@ -0,0 +1,25 @@ +belongsTo('App\User'); + } + + public function store() + { + return $this->belongsTo('App\User'); + } + + public function receipt_items() + { + return $this->hasMany('App\Models\ReceiptItem'); + } +} diff --git a/paragonik-backend/app/Models/ReceiptItem.php b/paragonik-backend/app/Models/ReceiptItem.php new file mode 100644 index 0000000..d4780c6 --- /dev/null +++ b/paragonik-backend/app/Models/ReceiptItem.php @@ -0,0 +1,21 @@ +belongsTo('App\Models\Receipt'); + } + + public function categories() + { + return $this->hasMany('App\Models\Category'); + } +} diff --git a/paragonik-backend/app/Models/Service.php b/paragonik-backend/app/Models/Service.php new file mode 100644 index 0000000..7fad8fb --- /dev/null +++ b/paragonik-backend/app/Models/Service.php @@ -0,0 +1,13 @@ +belongsToMany('App\Models\Category', 'categories_services'); + } +} diff --git a/paragonik-backend/app/Models/Store.php b/paragonik-backend/app/Models/Store.php new file mode 100644 index 0000000..0aac03c --- /dev/null +++ b/paragonik-backend/app/Models/Store.php @@ -0,0 +1,13 @@ +hasMany('App\Models\Receipt'); + } +} diff --git a/paragonik-backend/app/User.php b/paragonik-backend/app/User.php index faa03c3..373162d 100644 --- a/paragonik-backend/app/User.php +++ b/paragonik-backend/app/User.php @@ -36,4 +36,10 @@ class User extends Authenticatable protected $casts = [ 'email_verified_at' => 'datetime', ]; + + + public function receipts() + { + return $this->hasMany('App\Models\Receipt'); + } }