Skip to content

Commit

Permalink
Merge pull request #1 from webceyhan/develop
Browse files Browse the repository at this point in the history
Add foundation models
  • Loading branch information
webceyhan authored Apr 19, 2024
2 parents 3fd7ca6 + b3b207a commit 3ae380b
Show file tree
Hide file tree
Showing 60 changed files with 3,713 additions and 42 deletions.
84 changes: 52 additions & 32 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,62 @@ name: Laravel

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
laravel-tests:

runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: laravel
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

env:
DB_CONNECTION: mysql
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: secret

steps:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Install node dependencies
run: npm install

- name: Compiling assets
run: npm run build

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test
- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"

- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Generate key
run: php artisan key:generate

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Install node dependencies
run: npm install

- name: Compiling assets
run: npm run build

# - name: Create Database
# run: |
# mkdir -p database
# touch database/database.sqlite

- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
# env:
# DB_CONNECTION: sqlite
# DB_DATABASE: database/database.sqlite
run: php artisan test
14 changes: 14 additions & 0 deletions app/Enums/Concerns/HasValues.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace App\Enums\Concerns;

trait HasValues
{
/**
* Get all enum values as an array.
*/
public static function values(): array
{
return array_column(static::cases(), 'value');
}
}
36 changes: 36 additions & 0 deletions app/Enums/DeviceStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum DeviceStatus: string
{
use HasValues;

/**
* Represents a device that has been checked in and is awaiting repair.
* @default
*/
case CheckedIn = 'checked_in';

/**
* Represents a device that is currently on hold due to pending approval or parts.
*/
case OnHold = 'on_hold';

/**
* Represents a device that is currently being repaired by a technician.
*/
case InRepair = 'in_repair';

/**
* Represents that the repair work has been completed, ready to picked up.
*/
case Finished = 'finished';

/**
* Represents a device that has been returned to the customer.
*/
case CheckedOut = 'checked_out';
}
37 changes: 37 additions & 0 deletions app/Enums/DeviceType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum DeviceType: string
{
use HasValues;

/**
* Represents a mobile phone device.
*/
case Phone = 'phone';

/**
* Represents a tablet device.
*/
case Tablet = 'tablet';

/**
* Represents a laptop device.
*/
case Laptop = 'laptop';

/**
* Represents a desktop computer device.
*/
case Desktop = 'desktop';

/**
* Represents any other device not listed such as a smartwatch or smart TV,
* navigation system, game console, peripheral devices, etc.
* @default
*/
case Other = 'other';
}
31 changes: 31 additions & 0 deletions app/Enums/OrderStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum OrderStatus: string
{
use HasValues;

/**
* Represents an order that has been created and is awaiting processing.
* @default
*/
case New = 'new';

/**
* Represents an order that has been shipped to the customer.
*/
case Shipped = 'shipped';

/**
* Represents an order that has been received by the customer.
*/
case Received = 'received';

/**
* Represents an order that has been cancelled by the customer or by the system.
*/
case Cancelled = 'cancelled';
}
26 changes: 26 additions & 0 deletions app/Enums/Priority.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum Priority: string
{
use HasValues;

/**
* The model has a low priority and can be addressed later.
*/
case Low = 'low';

/**
* The model has a normal priority and should be addressed soon.
* @default
*/
case Normal = 'normal';

/**
* The model has a high priority and should be addressed as soon as possible.
*/
case High = 'high';
}
31 changes: 31 additions & 0 deletions app/Enums/TaskStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum TaskStatus: string
{
use HasValues;

/**
* Represents an task that has been created and is pending approval.
* @default
*/
case New = 'new';

/**
* Represents an task that has been approved and ready to be processed.
*/
case Approved = 'approved';

/**
* Represents an task that has been completed.
*/
case Completed = 'completed';

/**
* Represents an task that has been cancelled.
*/
case Cancelled = 'cancelled';
}
46 changes: 46 additions & 0 deletions app/Enums/TaskType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum TaskType: string
{
use HasValues;

/**
* Represents a task involving the repair of a device.
* This type of task addresses issues or damages in a device that require fixing.
* @default
*/
case Repair = 'repair';

/**
* Represents a task involving the maintenance of a device.
* Maintenance tasks focus on keeping a device in optimal condition, preventing failures or breakdowns.
*/
case Maintenance = 'maintenance';

/**
* Represents a task involving the installation of a device.
* Installation tasks entail setting up and configuring a device for its intended use.
*/
case Installation = 'installation';

/**
* Represents a task involving the inspection of a device.
* Inspection tasks involve assessing the condition or performance of a device to identify any issues or potential problems.
*/
case Inspection = 'inspection';

/**
* Represents a task involving the upgrade of a device.
* Upgrade tasks involve improving the functionality or performance of a device by replacing components or software.
*/
case Upgrade = 'upgrade';

/**
* Represents any other task not listed, such as consultation or training.
*/
case Other = 'other';
}
36 changes: 36 additions & 0 deletions app/Enums/TicketStatus.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum TicketStatus: string
{
use HasValues;

/**
* The ticket is new and has not been assigned to anyone.
* @default
*/
case New = 'new';

/**
* The ticket has been assigned to a technician and is in progress.
*/
case InProgress = 'in_progress';

/**
* The ticket is on hold and is not being worked on.
*/
case OnHold = 'on_hold';

/**
* The ticket has been resolved and is awaiting verification.
*/
case Resolved = 'resolved';

/**
* The ticket has been closed and is no longer active.
*/
case Closed = 'closed';
}
26 changes: 26 additions & 0 deletions app/Enums/TransactionMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Enums;

use App\Enums\Concerns\HasValues;

enum TransactionMethod: string
{
use HasValues;

/**
* Represents transactions via cash.
* @default
*/
case Cash = 'cash';

/**
* Represents transactions via credit or debit cards.
*/
case Card = 'card';

/**
* Represents transaction via online payment systems.
*/
case Online = 'online';
}
Loading

0 comments on commit 3ae380b

Please sign in to comment.