Commit fb8995ec authored by Sarun Mungthanya's avatar Sarun Mungthanya
Browse files

main

parents
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'name' => fake()->name(),
'email' => fake()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return static
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('uid');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
};
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class CompaniesSeeder extends Seeder
{
public function run()
{
// Define the number of companies you want to generate
$numCompanies = 2;
// Generate dummy data for companies
for ($i = 0; $i < $numCompanies; $i++) {
DB::table('companies')->insert([
'company_type_id' => 1, // Replace 5 with the maximum company_type_id in your company_types table
'name' => 'Company ' . ($i + 1),
'name_en' => 'Company ' . ($i + 1) . ' (English)',
'address' => 'Address ' . ($i + 1),
'district' => 'District ' . ($i + 1),
'sub_province' => 'Sub Province ' . ($i + 1),
'province' => 'Province ' . ($i + 1),
'postcode' => '1000' . ($i + 1), // Replace '1000' with the desired postcode prefix
'contry_code' => '+66', // Replace '+66' with the desired country code
'phone' => '123456789' . ($i + 1), // Replace '123456789' with the desired phone number prefix
'fax' => '987654321' . ($i + 1), // Replace '987654321' with the desired fax number prefix
'tax' => '1234567890123', // Replace '1234567890123' with the desired tax number
'branch' => 'Branch ' . ($i + 1),
'tax_incentive' => 'Tax Incentive ' . ($i + 1),
'created_at' => now(),
'updated_at' => now(),
]);
}
}
}
\ No newline at end of file
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
\App\Models\User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
DB::table('users')->insert([
'name' => 'Piniastudio',
'email' => 'help@piniastudio.com',
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
]);
DB::table('company_types')->insert(
['name' => 'Sea']
);
DB::table('company_types')->insert(
['name' => 'Air']
);
$this->call([
PermissionSeeder::class,
RoleSeeder::class,
CompaniesSeeder::class,
]);
}
}
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Permission;
class PermissionSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$permissions = [
// File Management
['name' => 'upload-file', 'description' => 'Upload a file', 'permission_group_name' => 'File Management'],
['name' => 'download-file', 'description' => 'Download a file', 'permission_group_name' => 'File Management'],
// Header Management
['name' => 'add-header', 'description' => 'Add a header', 'permission_group_name' => 'Header Management'],
['name' => 'edit-header', 'description' => 'Edit a header', 'permission_group_name' => 'Header Management'],
['name' => 'delete-header', 'description' => 'Delete a header', 'permission_group_name' => 'Header Management'],
['name' => 'send-customs', 'description' => 'Send customs', 'permission_group_name' => 'Header Management'],
['name' => 'export-to-spn', 'description' => 'Export to SPN', 'permission_group_name' => 'Header Management'],
['name' => 'cancel-header', 'description' => 'Cancel a header', 'permission_group_name' => 'Header Management'],
// Detail Management
['name' => 'add-detail', 'description' => 'Add a detail', 'permission_group_name' => 'Detail Management'],
['name' => 'edit-detail', 'description' => 'Edit a detail', 'permission_group_name' => 'Detail Management'],
['name' => 'cancel-detail', 'description' => 'Cancel a detail', 'permission_group_name' => 'Detail Management'],
['name' => 'merge-vessel', 'description' => 'Merge vessel', 'permission_group_name' => 'Detail Management'],
// Item Management
['name' => 'add-item', 'description' => 'Add an item', 'permission_group_name' => 'Item Management'],
['name' => 'edit-item', 'description' => 'Edit an item', 'permission_group_name' => 'Item Management'],
// Flight Management
['name' => 'change-flight', 'description' => 'Change flight', 'permission_group_name' => 'Flight Management'],
// User Management
['name' => 'add-user', 'description' => 'Add a user', 'permission_group_name' => 'User Management'],
['name' => 'edit-user', 'description' => 'Edit a user', 'permission_group_name' => 'User Management'],
['name' => 'delete-user', 'description' => 'Delete a user', 'permission_group_name' => 'User Management'],
// Role Management
['name' => 'add-role', 'description' => 'Add a role', 'permission_group_name' => 'Role Management'],
['name' => 'edit-role', 'description' => 'Edit a role', 'permission_group_name' => 'Role Management'],
['name' => 'delete-role', 'description' => 'Delete a role', 'permission_group_name' => 'Role Management'],
// Group Management
['name' => 'add-group', 'description' => 'Add a group', 'permission_group_name' => 'Group Management'],
['name' => 'edit-group', 'description' => 'Edit a group', 'permission_group_name' => 'Group Management'],
['name' => 'delete-group', 'description' => 'Delete a group', 'permission_group_name' => 'Group Management'],
// Company Management
['name' => 'add-company', 'description' => 'Add a company', 'permission_group_name' => 'Company Management'],
['name' => 'edit-company', 'description' => 'Edit a company', 'permission_group_name' => 'Company Management'],
['name' => 'delete-company', 'description' => 'Delete a company', 'permission_group_name' => 'Company Management'],
// Company Type Management
['name' => 'add-company-type', 'description' => 'Add a company type', 'permission_group_name' => 'Company Type Management'],
['name' => 'edit-company-type', 'description' => 'Edit a company type', 'permission_group_name' => 'Company Type Management'],
['name' => 'delete-company-type', 'description' => 'Delete a company type', 'permission_group_name' => 'Company Type Management']
];
// // Insert permissions into the database
foreach ($permissions as $permission) {
Permission::create($permission);
}
}
}
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Role;
use App\Models\Permission;
class RoleSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Define permissions for each role
$adminPermissions = [
'add-header', 'edit-header', 'delete-header', 'send-customs', 'export-to-spn',
'cancel-header', 'cancel-detail', 'merge-vessel', 'add-detail', 'edit-detail',
'add-item', 'edit-item', 'download-file', 'change-flight',
'add-user', 'edit-user', 'delete-user',
'add-role', 'edit-role', 'delete-role',
'add-group', 'edit-group', 'delete-group',
'add-company', 'edit-company', 'delete-company',
'add-company-type', 'edit-company-type', 'delete-company-type',
];
$managerPermissions = [
'add-header', 'edit-header', 'delete-header', 'send-customs',
'cancel-header', 'cancel-detail', 'merge-vessel', 'add-detail', 'edit-detail',
'add-item', 'edit-item', 'download-file', 'change-flight',
'add-user', 'edit-user',
'add-group', 'edit-group',
'add-company', 'edit-company',
'add-company-type', 'edit-company-type',
];
$userPermissions = [
'add-header', 'edit-header', 'send-customs',
'cancel-header', 'cancel-detail', 'add-detail', 'edit-detail',
'add-item', 'edit-item', 'download-file',
];
// Create roles
$adminRole = Role::create(['name' => 'Admin', 'description' => 'Administrator']);
$managerRole = Role::create(['name' => 'Manager', 'description' => 'Manager']);
$userRole = Role::create(['name' => 'User', 'description' => 'User']);
// Assign permissions to roles
$this->assignPermissions($adminRole, $adminPermissions);
$this->assignPermissions($managerRole, $managerPermissions);
$this->assignPermissions($userRole, $userPermissions);
}
private function assignPermissions($role, $permissions)
{
foreach ($permissions as $permissionName) {
$permission = Permission::where('name', $permissionName)->first();
if ($permission) {
$role->permissions()->attach($permission);
}
}
}
}
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'password' => 'The provided password is incorrect.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute must only contain letters.',
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute must only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute must have between :min and :max items.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'numeric' => 'The :attribute must be between :min and :max.',
'string' => 'The :attribute must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
'date_format' => 'The :attribute does not match the format :format.',
'declined' => 'The :attribute must be declined.',
'declined_if' => 'The :attribute must be declined when :other is :value.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute must have more than :value items.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'numeric' => 'The :attribute must be greater than :value.',
'string' => 'The :attribute must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute must have :value items or more.',
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be greater than or equal to :value.',
'string' => 'The :attribute must be greater than or equal to :value characters.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'array' => 'The :attribute must have less than :value items.',
'file' => 'The :attribute must be less than :value kilobytes.',
'numeric' => 'The :attribute must be less than :value.',
'string' => 'The :attribute must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute must be less than or equal to :value.',
'string' => 'The :attribute must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute must be a valid MAC address.',
'max' => [
'array' => 'The :attribute must not have more than :max items.',
'file' => 'The :attribute must not be greater than :max kilobytes.',
'numeric' => 'The :attribute must not be greater than :max.',
'string' => 'The :attribute must not be greater than :max characters.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'numeric' => 'The :attribute must be at least :min.',
'string' => 'The :attribute must be at least :min characters.',
],
'multiple_of' => 'The :attribute must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'password' => [
'letters' => 'The :attribute must contain at least one letter.',
'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute must contain at least one number.',
'symbols' => 'The :attribute must contain at least one symbol.',
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
],
'present' => 'The :attribute field must be present.',
'prohibited' => 'The :attribute field is prohibited.',
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
'prohibits' => 'The :attribute field prohibits :other from being present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'numeric' => 'The :attribute must be :size.',
'string' => 'The :attribute must be :size characters.',
],
'starts_with' => 'The :attribute must start with one of the following: :values.',
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute must be a valid URL.',
'uuid' => 'The :attribute must be a valid UUID.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];
{
"name": "lineone",
"version": "1.5.0",
"description": "Multipurpose Admin UI Kit based on Tailwind CSS",
"private": true,
"author": "PiniaStudio",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/line-clamp": "^0.4.2",
"autoprefixer": "^10.4.13",
"axios": "^1.3",
"laravel-vite-plugin": "^0.7.4",
"lodash": "^4.17.21",
"postcss": "^8.4.21",
"prettier": "^2.8.4",
"prettier-plugin-tailwindcss": "^0.2.2",
"tailwindcss": "^3.2.6",
"vite": "^4.1.1",
"vite-plugin-externals": "^0.6.2"
},
"dependencies": {
"@alpinejs/collapse": "^3.11.1",
"@alpinejs/intersect": "^3.11.1",
"@alpinejs/persist": "^3.11.1",
"@caneara/iodine": "^8.3.0",
"@fortawesome/fontawesome-free": "^6.3.0",
"@popperjs/core": "^2.11.6",
"alpinejs": "^3.11.1",
"apexcharts": "^3.37.0",
"cleave.js": "^1.6.0",
"dayjs": "^1.11.7",
"esbuild": "^0.20.2",
"filepond": "^4.30.4",
"filepond-plugin-file-encode": "^2.1.14",
"filepond-plugin-image-preview": "^4.6.11",
"flatpickr": "^4.6.13",
"gridjs": "^6.0.6",
"highlight.js": "^11.7.0",
"jquery": "^3.7.1",
"quill": "^1.3.7",
"simplebar": "^6.2.1",
"sortablejs": "^1.15.0",
"swiper": "^9.0.5",
"tippy.js": "^6.3.7",
"toastify-js": "^1.12.0",
"tom-select": "^2.2.2"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>
module.exports = {
map: { inline: true },
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment