first initial

This commit is contained in:
2025-05-27 19:09:17 +07:00
commit 80375d8af3
1587 changed files with 572586 additions and 0 deletions

15
app/Models/Category.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Category extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
"name", "form"
];
}

25
app/Models/Dealer.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Dealer extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
'dealer_code', 'name', 'address', 'pic'
];
/**
* Get all of the transactions for the Dealer
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactions()
{
return $this->hasMany(Transaction::class, 'dealer_id', 'id');
}
}

14
app/Models/Menu.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
use HasFactory;
protected $fillable = [
'name', 'link'
];
}

14
app/Models/Privilege.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Privilege extends Model
{
use HasFactory;
protected $fillable = [
'role_id', 'menu_id', 'create', 'update', 'view', 'delete'
];
}

14
app/Models/Role.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $fillable = [
'name'
];
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Transaction extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
"user_id", "user_sa_id", "work_id", "form", "spk", "police_number", "warranty", "date", "qty", "status", "dealer_id"
];
/**
* Get the work associated with the Transaction
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function work()
{
return $this->hasOne(Work::class, 'id', 'work_id');
}
}

78
app/Models/User.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'role',
'dealer_id',
'password',
'role_id'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* Get all of the transactions for the User
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactions()
{
return $this->hasMany(Transaction::class, 'user_id', 'id');
}
/**
* Get all of the sa_transactions for the User
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function sa_transactions()
{
return $this->hasMany(Transaction::class, 'user_sa_id', 'id');
}
/**
* Get the dealer associated with the User
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function dealer()
{
return $this->hasOne(Dealer::class, 'id', 'dealer_id');
}
}

25
app/Models/Work.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Work extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = [
"category_id", "name", "desc", "shortname"
];
/**
* Get all of the transactions for the Work
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactions()
{
return $this->hasMany(Transaction::class, 'work_id', 'id');
}
}