Skip to content

Commit

Permalink
chore: refactor seeders, factories and model names
Browse files Browse the repository at this point in the history
  • Loading branch information
kamgrzeski committed Nov 26, 2024
1 parent 28396d2 commit 89af6ce
Show file tree
Hide file tree
Showing 51 changed files with 635 additions and 524 deletions.
7 changes: 3 additions & 4 deletions app/Models/AdminModel.php → app/Models/Administrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class AdminModel extends Authenticatable
class Administrator extends Authenticatable
{
protected $table = 'admins';

use Notifiable;
use HasFactory, Notifiable;

/**
* The attributes that are mass assignable.
Expand Down
8 changes: 3 additions & 5 deletions app/Models/ClientsModel.php → app/Models/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

use App\Relations\Has\HasManyCompanies;
use App\Relations\Has\HasManyEmployees;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class ClientsModel extends Model
class Client extends Model
{
use SoftDeletes, HasManyEmployees, HasManyCompanies;

protected $table = 'clients';
protected $dates = ['deleted_at'];
use HasFactory, SoftDeletes, HasManyEmployees, HasManyCompanies;

protected $fillable = [
'full_name', 'phone', 'email', 'section', 'budget', 'location', 'zip', 'city', 'country', 'is_active', 'admin_id'
Expand Down
35 changes: 0 additions & 35 deletions app/Models/CompaniesModel.php

This file was deleted.

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

namespace App\Models;

use App\Relations\Belongs\BelongsToClient;
use App\Relations\Belongs\BelongsToEmployee;
use App\Relations\Has\HasManyDeals;
use App\Relations\Has\HasManyFinances;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Company extends Model
{
use HasFactory, SoftDeletes, BelongsToClient, HasManyDeals, HasManyFinances, BelongsToEmployee;

protected $fillable = ['name', 'tax_number', 'phone', 'city', 'billing_address', 'country', 'postal_code',
'employees_size', 'fax', 'description', 'client_id', 'created_at', 'is_active', 'admin_id'
];
}
16 changes: 16 additions & 0 deletions app/Models/Deal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Models;

use App\Relations\Belongs\BelongsToCompany;
use App\Relations\Has\HasManyDealTerms;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Deal extends Model
{
use HasFactory, SoftDeletes, BelongsToCompany, HasManyDealTerms;

protected $fillable = ['name', 'start_time', 'end_time', 'company_id', 'is_active', 'admin_id'];
}
14 changes: 14 additions & 0 deletions app/Models/DealTerm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class DealTerm extends Model
{
use HasFactory, SoftDeletes;

protected $fillable = ['body', 'deal_id'];
}
18 changes: 0 additions & 18 deletions app/Models/DealsModel.php

This file was deleted.

14 changes: 0 additions & 14 deletions app/Models/DealsTermsModel.php

This file was deleted.

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

namespace App\Models;

use App\Relations\Belongs\BelongsToClient;
use App\Relations\Belongs\BelongsToDeal;
use App\Relations\Has\HasManyCompanies;
use App\Relations\Has\HasManyTasks;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Employee extends Model
{
use HasFactory, SoftDeletes, HasManyCompanies, BelongsToDeal, BelongsToClient, HasManyTasks;

protected $fillable = ['full_name', 'email', 'phone', 'client_id', 'is_active', 'job', 'note', 'admin_id', 'created_at',
'updated_at', 'deleted_at'
];
}

30 changes: 0 additions & 30 deletions app/Models/EmployeesModel.php

This file was deleted.

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

namespace App\Models;

use App\Relations\Belongs\BelongsToCompany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Finance extends Model
{
use HasFactory, SoftDeletes, BelongsToCompany;

protected $fillable = ['name', 'company_id', 'gross', 'net', 'vat', 'description', 'category', 'type', 'date',
'is_active', 'created_at', 'updated_at' ];

protected $casts = [
'date' => 'datetime',
];
}
32 changes: 0 additions & 32 deletions app/Models/FinancesModel.php

This file was deleted.

8 changes: 3 additions & 5 deletions app/Models/ProductsModel.php → app/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
namespace App\Models;

use App\Relations\Has\HasManySales;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class ProductsModel extends Model
class Product extends Model
{
use SoftDeletes, HasManySales;

protected $table = 'products';
protected $dates = ['deleted_at'];
use HasFactory, SoftDeletes, HasManySales;

protected $fillable = ['name', 'category', 'count', 'price', 'is_active', 'admin_id'];
}
19 changes: 19 additions & 0 deletions app/Models/Sale.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Models;

use App\Relations\Belongs\BelongsToProduct;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Sale extends Model
{
use HasFactory, SoftDeletes, BelongsToProduct;

protected $fillable = ['name', 'quantity', 'price', 'date_of_payment', 'product_id', 'is_active', 'admin_id'];

protected $casts = [
'date_of_payment' => 'datetime'
];
}
21 changes: 0 additions & 21 deletions app/Models/SalesModel.php

This file was deleted.

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

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Setting extends Model
{
use HasFactory;
}
10 changes: 0 additions & 10 deletions app/Models/SettingsModel.php

This file was deleted.

5 changes: 3 additions & 2 deletions app/Models/SystemLogsModel.php → app/Models/SystemLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SystemLogsModel extends Model
class SystemLog extends Model
{
protected $table = 'systemlogs';
use HasFactory;

public string $ip = '66.249.69.115'; // googlebot

Expand Down
8 changes: 3 additions & 5 deletions app/Models/TasksModel.php → app/Models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
namespace App\Models;

use App\Relations\Belongs\BelongsToEmployee;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class TasksModel extends Model
class Task extends Model
{
use SoftDeletes, BelongsToEmployee;
use HasFactory, SoftDeletes, BelongsToEmployee;

protected $fillable = ['name', 'employee_id', 'duration', 'is_active', 'completed', 'admin_id'];

protected $table = 'tasks';
protected $dates = ['deleted_at'];
}
Loading

0 comments on commit 89af6ce

Please sign in to comment.