Models
This commit is contained in:
parent
a71da979fd
commit
344b6e19da
18
paragonik-backend/app/Models/Category.php
Normal file
18
paragonik-backend/app/Models/Category.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
public function receipt_items()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ReceiptItem');
|
||||
}
|
||||
|
||||
public function services()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Service', 'categories_services');
|
||||
}
|
||||
}
|
23
paragonik-backend/app/Models/Receipt.php
Normal file
23
paragonik-backend/app/Models/Receipt.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Receipt extends Model
|
||||
{
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function receipt_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\ReceiptItem');
|
||||
}
|
||||
}
|
20
paragonik-backend/app/Models/ReceiptItem.php
Normal file
20
paragonik-backend/app/Models/ReceiptItem.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ReceiptItem extends Model
|
||||
{
|
||||
protected $table = 'receipt_items';
|
||||
|
||||
public function receipts()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Receipt');
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Category');
|
||||
}
|
||||
}
|
13
paragonik-backend/app/Models/Service.php
Normal file
13
paragonik-backend/app/Models/Service.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany('App\Models\Category', 'categories_services');
|
||||
}
|
||||
}
|
13
paragonik-backend/app/Models/Store.php
Normal file
13
paragonik-backend/app/Models/Store.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Store extends Model
|
||||
{
|
||||
public function post()
|
||||
{
|
||||
return $this->hasMany('App\Models\Receipt');
|
||||
}
|
||||
}
|
45
paragonik-backend/app/User.php
Normal file
45
paragonik-backend/app/User.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
|
||||
public function receipts()
|
||||
{
|
||||
return $this->hasMany('App\Models\Receipt');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user