Fix backend code styling

This commit is contained in:
MakingCG
2021-04-29 09:07:05 +00:00
committed by GitHub Actions
parent 1486ce63fa
commit 120973ae00
38 changed files with 542 additions and 605 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+143 -152
View File
@@ -392,38 +392,37 @@ class SetupDevEnvironment extends Command
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Project Notes', 'name' => 'Project Notes',
'basename' => 'Project Notes.pdf', 'basename' => 'Project Notes.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Personal Savings', 'name' => 'Personal Savings',
'basename' => 'School Report.pages', 'basename' => 'School Report.pages',
'mimetype' => 'pages', 'mimetype' => 'pages',
], ],
[ [
'name' => 'License', 'name' => 'License',
'basename' => 'Stories of the Night Skies.pages', 'basename' => 'Stories of the Night Skies.pages',
'mimetype' => 'pages', 'mimetype' => 'pages',
], ],
]) ])
->each(function ($file) use ($user, $documents) { ->each(function ($file) use ($user, $documents) {
$basename = Str::random(12) . '-' . $file['basename']; $basename = Str::random(12) . '-' . $file['basename'];
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $documents->id, 'folder_id' => $documents->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file['name'], 'name' => $file['name'],
'basename' => $basename, 'basename' => $basename,
'type' => 'file', 'type' => 'file',
'author' => 'user', 'author' => 'user',
'mimetype' => $file['mimetype'], 'mimetype' => $file['mimetype'],
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -431,33 +430,32 @@ class SetupDevEnvironment extends Command
// Get documents to shared folder // Get documents to shared folder
collect([ collect([
[ [
'name' => 'Home plan', 'name' => 'Home plan',
'basename' => 'Licence.pdf', 'basename' => 'Licence.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Software Licence', 'name' => 'Software Licence',
'basename' => 'Project Notes.pdf', 'basename' => 'Project Notes.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
] ],
]) ])
->each(function ($file) use ($user, $shared_folder) { ->each(function ($file) use ($user, $shared_folder) {
$basename = Str::random(12) . '-' . $file['basename']; $basename = Str::random(12) . '-' . $file['basename'];
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $shared_folder->id, 'folder_id' => $shared_folder->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file['name'], 'name' => $file['name'],
'basename' => $basename, 'basename' => $basename,
'type' => 'file', 'type' => 'file',
'author' => 'user', 'author' => 'user',
'mimetype' => $file['mimetype'], 'mimetype' => $file['mimetype'],
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -465,58 +463,57 @@ class SetupDevEnvironment extends Command
// Get documents to peter's files folder // Get documents to peter's files folder
collect([ collect([
[ [
'name' => 'Project Backup', 'name' => 'Project Backup',
'basename' => 'Licence.pdf', 'basename' => 'Licence.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Yearly report', 'name' => 'Yearly report',
'basename' => 'Project Notes.pdf', 'basename' => 'Project Notes.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Work Update', 'name' => 'Work Update',
'basename' => 'School Report.pages', 'basename' => 'School Report.pages',
'mimetype' => 'pages', 'mimetype' => 'pages',
], ],
[ [
'name' => 'Person Writing on Notebook', 'name' => 'Person Writing on Notebook',
'basename' => 'Stories of the Night Skies.pages', 'basename' => 'Stories of the Night Skies.pages',
'mimetype' => 'pages', 'mimetype' => 'pages',
], ],
[ [
'name' => 'Blank Business Composition Computer', 'name' => 'Blank Business Composition Computer',
'basename' => 'Licence.pdf', 'basename' => 'Licence.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => '2020 April - Export', 'name' => '2020 April - Export',
'basename' => 'Project Notes.pdf', 'basename' => 'Project Notes.pdf',
'mimetype' => 'pdf', 'mimetype' => 'pdf',
], ],
[ [
'name' => 'Ballpen Blur Close Up Computer', 'name' => 'Ballpen Blur Close Up Computer',
'basename' => 'School Report.pages', 'basename' => 'School Report.pages',
'mimetype' => 'pages', 'mimetype' => 'pages',
], ],
]) ])
->each(function ($file) use ($user, $peters_files) { ->each(function ($file) use ($user, $peters_files) {
$basename = Str::random(12) . '-' . $file['basename']; $basename = Str::random(12) . '-' . $file['basename'];
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $peters_files->id, 'folder_id' => $peters_files->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file['name'], 'name' => $file['name'],
'basename' => $basename, 'basename' => $basename,
'type' => 'file', 'type' => 'file',
'author' => 'visitor', 'author' => 'visitor',
'mimetype' => $file['mimetype'], 'mimetype' => $file['mimetype'],
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -529,22 +526,21 @@ class SetupDevEnvironment extends Command
'Sphere Bound 3D Titles.mp4', 'Sphere Bound 3D Titles.mp4',
]) ])
->each(function ($file) use ($user, $videohive) { ->each(function ($file) use ($user, $videohive) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $videohive->id, 'folder_id' => $videohive->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'video', 'type' => 'video',
'author' => 'user', 'author' => 'user',
'mimetype' => 'mp4', 'mimetype' => 'mp4',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -554,22 +550,21 @@ class SetupDevEnvironment extends Command
'Apple Watch App Video Promotion.mp4', 'Apple Watch App Video Promotion.mp4',
]) ])
->each(function ($file) use ($user, $video) { ->each(function ($file) use ($user, $video) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $video->id, 'folder_id' => $video->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'video', 'type' => 'video',
'author' => 'user', 'author' => 'user',
'mimetype' => 'mp4', 'mimetype' => 'mp4',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -579,22 +574,21 @@ class SetupDevEnvironment extends Command
'D-Block & S-te-Fan - Bla Bla.mp3', 'D-Block & S-te-Fan - Bla Bla.mp3',
]) ])
->each(function ($file) use ($user, $audio) { ->each(function ($file) use ($user, $audio) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $audio->id, 'folder_id' => $audio->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'audio', 'type' => 'audio',
'author' => 'user', 'author' => 'user',
'mimetype' => 'mp3', 'mimetype' => 'mp3',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -615,24 +609,23 @@ class SetupDevEnvironment extends Command
'You Are My Sunshine.jpg', 'You Are My Sunshine.jpg',
]) ])
->each(function ($file) use ($user, $apartments) { ->each(function ($file) use ($user, $apartments) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, 'private');
Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => null, 'folder_id' => null,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'image', 'type' => 'image',
'author' => 'user', 'author' => 'user',
'mimetype' => 'jpg', 'mimetype' => 'jpg',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'thumbnail' => "thumbnail-$basename", 'thumbnail' => "thumbnail-$basename",
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -648,24 +641,23 @@ class SetupDevEnvironment extends Command
'Kitchen Island.jpg', 'Kitchen Island.jpg',
]) ])
->each(function ($file) use ($user, $apartments) { ->each(function ($file) use ($user, $apartments) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, 'private');
Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $apartments->id, 'folder_id' => $apartments->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'image', 'type' => 'image',
'author' => 'user', 'author' => 'user',
'mimetype' => 'jpg', 'mimetype' => 'jpg',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'thumbnail' => "thumbnail-$basename", 'thumbnail' => "thumbnail-$basename",
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -685,24 +677,23 @@ class SetupDevEnvironment extends Command
'Yellow Animal Eyes Fur.jpg', 'Yellow Animal Eyes Fur.jpg',
]) ])
->each(function ($file) use ($user, $nature) { ->each(function ($file) use ($user, $nature) {
$basename = Str::random(12) . '-' . $file; $basename = Str::random(12) . '-' . $file;
// Copy file into app storage // Copy file into app storage
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, 'private');
Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", "private"); Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", 'private');
// Create file record // Create file record
File::create([ File::create([
'folder_id' => $nature->id, 'folder_id' => $nature->id,
'user_id' => $user->id, 'user_id' => $user->id,
'name' => $file, 'name' => $file,
'basename' => $basename, 'basename' => $basename,
'type' => 'image', 'type' => 'image',
'author' => 'user', 'author' => 'user',
'mimetype' => 'jpg', 'mimetype' => 'jpg',
'filesize' => rand(1000000, 4000000), 'filesize' => rand(1000000, 4000000),
'thumbnail' => "thumbnail-$basename", 'thumbnail' => "thumbnail-$basename",
'created_at' => now()->subMinutes(rand(1, 5)), 'created_at' => now()->subMinutes(rand(1, 5)),
]); ]);
}); });
@@ -720,13 +711,13 @@ class SetupDevEnvironment extends Command
$images->each(function ($id) use ($user) { $images->each(function ($id) use ($user) {
Share::create([ Share::create([
'user_id' => $user->id, 'user_id' => $user->id,
'item_id' => $id, 'item_id' => $id,
'type' => 'file', 'type' => 'file',
'is_protected' => false, 'is_protected' => false,
'permission' => 'editor', 'permission' => 'editor',
'password' => null, 'password' => null,
'expire_in' => null, 'expire_in' => null,
]); ]);
}); });
@@ -737,13 +728,13 @@ class SetupDevEnvironment extends Command
$files->each(function ($id) use ($user) { $files->each(function ($id) use ($user) {
Share::create([ Share::create([
'user_id' => $user->id, 'user_id' => $user->id,
'item_id' => $id, 'item_id' => $id,
'type' => 'file', 'type' => 'file',
'is_protected' => false, 'is_protected' => false,
'permission' => 'editor', 'permission' => 'editor',
'password' => null, 'password' => null,
'expire_in' => null, 'expire_in' => null,
]); ]);
}); });
} }
@@ -756,116 +747,116 @@ class SetupDevEnvironment extends Command
// Get options // Get options
collect([ collect([
[ [
'name' => 'setup_wizard_database', 'name' => 'setup_wizard_database',
'value' => 1, 'value' => 1,
], ],
[ [
'name' => 'app_title', 'name' => 'app_title',
'value' => 'VueFileManager', 'value' => 'VueFileManager',
], ],
[ [
'name' => 'app_description', 'name' => 'app_description',
'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue', 'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue',
], ],
[ [
'name' => 'app_logo', 'name' => 'app_logo',
'value' => 'system/logo.svg', 'value' => 'system/logo.svg',
], ],
[ [
'name' => 'app_logo_horizontal', 'name' => 'app_logo_horizontal',
'value' => 'system/logo-horizontal.svg', 'value' => 'system/logo-horizontal.svg',
], ],
[ [
'name' => 'app_favicon', 'name' => 'app_favicon',
'value' => 'system/favicon.png', 'value' => 'system/favicon.png',
], ],
[ [
'name' => 'app_og_image', 'name' => 'app_og_image',
'value' => 'system/og-image.jpg', 'value' => 'system/og-image.jpg',
], ],
[ [
'name' => 'app_touch_icon', 'name' => 'app_touch_icon',
'value' => 'system/touch-icon.png', 'value' => 'system/touch-icon.png',
], ],
[ [
'name' => 'google_analytics', 'name' => 'google_analytics',
'value' => '', 'value' => '',
], ],
[ [
'name' => 'contact_email', 'name' => 'contact_email',
'value' => '', 'value' => '',
], ],
[ [
'name' => 'registration', 'name' => 'registration',
'value' => 1, 'value' => 1,
], ],
[ [
'name' => 'payments_active', 'name' => 'payments_active',
'value' => 1, 'value' => 1,
], ],
[ [
'name' => 'storage_limitation', 'name' => 'storage_limitation',
'value' => 1, 'value' => 1,
], ],
[ [
'name' => 'storage_default', 'name' => 'storage_default',
'value' => 5, 'value' => 5,
], ],
[ [
'name' => 'setup_wizard_success', 'name' => 'setup_wizard_success',
'value' => 1, 'value' => 1,
], ],
[ [
'name' => 'license', 'name' => 'license',
'value' => $this->license, 'value' => $this->license,
], ],
[ [
'name' => 'purchase_code', 'name' => 'purchase_code',
'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484', 'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484',
], ],
[ [
'name' => 'billing_address', 'name' => 'billing_address',
'value' => 'Palo Alto 20', 'value' => 'Palo Alto 20',
], ],
[ [
'name' => 'billing_city', 'name' => 'billing_city',
'value' => 'Palo Alto', 'value' => 'Palo Alto',
], ],
[ [
'name' => 'billing_country', 'name' => 'billing_country',
'value' => 'US', 'value' => 'US',
], ],
[ [
'name' => 'billing_name', 'name' => 'billing_name',
'value' => 'VueFileManager Inc.', 'value' => 'VueFileManager Inc.',
], ],
[ [
'name' => 'billing_phone_number', 'name' => 'billing_phone_number',
'value' => '312343141243214', 'value' => '312343141243214',
], ],
[ [
'name' => 'billing_postal_code', 'name' => 'billing_postal_code',
'value' => '43213', 'value' => '43213',
], ],
[ [
'name' => 'billing_state', 'name' => 'billing_state',
'value' => 'California', 'value' => 'California',
], ],
[ [
'name' => 'billing_vat_number', 'name' => 'billing_vat_number',
'value' => '41241241234', 'value' => '41241241234',
] ],
])->each(function ($col) { ])->each(function ($col) {
Setting::forceCreate([ Setting::forceCreate([
'name' => $col['name'], 'name' => $col['name'],
'value' => $col['value'] 'value' => $col['value'],
]); ]);
}); });
// Get system images // Get system images
collect(['logo.svg', 'logo-horizontal.svg', 'favicon.png', 'og-image.jpg', 'touch-icon.png']) collect(['logo.svg', 'logo-horizontal.svg', 'favicon.png', 'og-image.jpg', 'touch-icon.png'])
->each(function ($file) { ->each(function ($file) {
Storage::putFileAs("system", storage_path("demo/app/$file"), $file, "private"); Storage::putFileAs('system', storage_path("demo/app/$file"), $file, 'private');
}); });
} }
@@ -876,12 +867,12 @@ class SetupDevEnvironment extends Command
{ {
// Migrate database // Migrate database
$this->call('migrate:fresh', [ $this->call('migrate:fresh', [
'--force' => true '--force' => true,
]); ]);
// Generate app key // Generate app key
$this->call('key:generate', [ $this->call('key:generate', [
'--force' => true '--force' => true,
]); ]);
} }
+32 -34
View File
@@ -1,15 +1,14 @@
<?php <?php
namespace App\Console\Commands; namespace App\Console\Commands;
use App\Models\User;
use App\Models\Setting;
use Illuminate\Support\Str;
use App\Models\Oasis\Client; use App\Models\Oasis\Client;
use App\Models\Oasis\Invoice; use App\Models\Oasis\Invoice;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Factories\Sequence;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Factories\Sequence;
class SetupOasisEnvironment extends Command class SetupOasisEnvironment extends Command
{ {
@@ -65,28 +64,28 @@ class SetupOasisEnvironment extends Command
$hash = Str::random(12); $hash = Str::random(12);
// Get invoice logo and stamp // Get invoice logo and stamp
Storage::putFileAs("system", storage_path("demo/app/logo-horizontal.svg"), "{$hash}-logo-horizontal.svg", "private"); Storage::putFileAs('system', storage_path('demo/app/logo-horizontal.svg'), "{$hash}-logo-horizontal.svg", 'private');
Storage::putFileAs("system", storage_path("demo/oasis/stamp.png"), "{$hash}-stamp.png", "private"); Storage::putFileAs('system', storage_path('demo/oasis/stamp.png'), "{$hash}-stamp.png", 'private');
$profile = $user->invoiceProfile()->create([ $profile = $user->invoiceProfile()->create([
'company' => 'VueFileManager Inc.', 'company' => 'VueFileManager Inc.',
'registration_notes' => 'Registrácia na OR SR Bratislava I. oddiel: Sro vl. č. 91906', 'registration_notes' => 'Registrácia na OR SR Bratislava I. oddiel: Sro vl. č. 91906',
'logo' => "system/{$hash}-logo-horizontal.svg", 'logo' => "system/{$hash}-logo-horizontal.svg",
'ico' => '46530045', 'ico' => '46530045',
'dic' => '2023489457', 'dic' => '2023489457',
'ic_dph' => 'SK2023489457', 'ic_dph' => 'SK2023489457',
'address' => 'Does 11', 'address' => 'Does 11',
'state' => 'Slovakia', 'state' => 'Slovakia',
'city' => 'Bratislava', 'city' => 'Bratislava',
'postal_code' => '04001', 'postal_code' => '04001',
'country' => 'SK', 'country' => 'SK',
'bank' => 'Fio Banka', 'bank' => 'Fio Banka',
'iban' => 'SK20000054236423624', 'iban' => 'SK20000054236423624',
'swift' => 'FIOZXXX', 'swift' => 'FIOZXXX',
'phone' => '+421950123456', 'phone' => '+421950123456',
'email' => 'howdy@hi5ve.digital', 'email' => 'howdy@hi5ve.digital',
'author' => 'John Doe', 'author' => 'John Doe',
'stamp' => "system/{$hash}-stamp.png", 'stamp' => "system/{$hash}-stamp.png",
]); ]);
$clients = Client::factory(Client::class) $clients = Client::factory(Client::class)
@@ -103,10 +102,10 @@ class SetupOasisEnvironment extends Command
['client_id' => $clients[5]->id], ['client_id' => $clients[5]->id],
))->count(2) ))->count(2)
->create([ ->create([
'user_id' => $user->id, 'user_id' => $user->id,
'invoice_type' => 'regular-invoice', 'invoice_type' => 'regular-invoice',
'discount_type' => null, 'discount_type' => null,
'user' => $profile->toArray(), 'user' => $profile->toArray(),
]); ]);
$advance_invoices = Invoice::factory(Invoice::class) $advance_invoices = Invoice::factory(Invoice::class)
@@ -119,22 +118,21 @@ class SetupOasisEnvironment extends Command
['client_id' => $clients[4]->id], ['client_id' => $clients[4]->id],
['client_id' => $clients[5]->id], ['client_id' => $clients[5]->id],
))->create([ ))->create([
'user_id' => $user->id, 'user_id' => $user->id,
'invoice_type' => 'advance-invoice', 'invoice_type' => 'advance-invoice',
'discount_type' => null, 'discount_type' => null,
'user' => $profile->toArray(), 'user' => $profile->toArray(),
]); ]);
// Generate PDF // Generate PDF
collect([$regular_invoices, $advance_invoices]) collect([$regular_invoices, $advance_invoices])
->collapse() ->collapse()
->each(function ($invoice) use ($user) { ->each(function ($invoice) use ($user) {
$this->info("Generating invoice id: $invoice->id"); $this->info("Generating invoice id: $invoice->id");
\PDF::loadView('oasis.invoices.invoice', [ \PDF::loadView('oasis.invoices.invoice', [
'invoice' => Invoice::find($invoice->id), 'invoice' => Invoice::find($invoice->id),
'user' => $user, 'user' => $user,
]) ])
->setPaper('a4') ->setPaper('a4')
->setOrientation('portrait') ->setOrientation('portrait')
@@ -147,9 +145,9 @@ class SetupOasisEnvironment extends Command
public function set_oasis_data() public function set_oasis_data()
{ {
Setting::updateOrCreate([ Setting::updateOrCreate([
'name' => 'app_color' 'name' => 'app_color',
], [ ], [
'value' => '#ae5fec' 'value' => '#ae5fec',
]); ]);
} }
} }
+30 -30
View File
@@ -1,23 +1,22 @@
<?php <?php
namespace App\Http\Controllers\Oasis; namespace App\Http\Controllers\Oasis;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\CreateUserByAdmin;
use App\Http\Requests\Oasis\CreateOrderRequest;
use App\Http\Resources\UserResource;
use App\Models\User;
use App\Models\UserSettings;
use App\Notifications\Oasis\PaymentRequiredNotification;
use App\Services\Oasis\CzechRegisterSearchService;
use App\Services\StripeService;
use Hash; use Hash;
use Illuminate\Contracts\Foundation\Application; use Notification;
use Illuminate\Contracts\Routing\ResponseFactory; use App\Models\User;
use Illuminate\Support\Str;
use App\Models\UserSettings;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Str; use App\Services\StripeService;
use Notification; use App\Http\Controllers\Controller;
use App\Http\Resources\UserResource;
use App\Http\Requests\Admin\CreateUserByAdmin;
use App\Http\Requests\Oasis\CreateOrderRequest;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use App\Services\Oasis\CzechRegisterSearchService;
use App\Notifications\Oasis\PaymentRequiredNotification;
class AdminController extends Controller class AdminController extends Controller
{ {
@@ -51,7 +50,7 @@ class AdminController extends Controller
{ {
// Create user // Create user
$newbie = User::create([ $newbie = User::create([
'email' => $request->email, 'email' => $request->email,
'password' => Hash::make(Str::random()), 'password' => Hash::make(Str::random()),
]); ]);
@@ -62,15 +61,15 @@ class AdminController extends Controller
->settings() ->settings()
->create([ ->create([
'storage_capacity' => 0, 'storage_capacity' => 0,
'ico' => $request->ico ?? null, 'ico' => $request->ico ?? null,
'name' => $request->name, 'name' => $request->name,
'address' => $request->address, 'address' => $request->address,
'state' => $request->state, 'state' => $request->state,
'city' => $request->city, 'city' => $request->city,
'postal_code' => $request->postal_code, 'postal_code' => $request->postal_code,
'country' => $request->country, 'country' => $request->country,
'phone_number' => $request->phone_number ?? null, 'phone_number' => $request->phone_number ?? null,
'timezone' => '1.0', 'timezone' => '1.0',
]); ]);
// Store subscription request // Store subscription request
@@ -90,7 +89,8 @@ class AdminController extends Controller
)); ));
return response( return response(
new UserResource($newbie), 201 new UserResource($newbie),
201
); );
} }
@@ -104,8 +104,8 @@ class AdminController extends Controller
{ {
// Create user // Create user
$user = User::forceCreate([ $user = User::forceCreate([
'role' => $request->role, 'role' => $request->role,
'email' => $request->email, 'email' => $request->email,
'password' => \Illuminate\Support\Facades\Hash::make($request->password), 'password' => \Illuminate\Support\Facades\Hash::make($request->password),
]); ]);
@@ -114,9 +114,9 @@ class AdminController extends Controller
$user $user
->settings() ->settings()
->create([ ->create([
'name' => $request->name, 'name' => $request->name,
'avatar' => store_avatar($request, 'avatar'), 'avatar' => store_avatar($request, 'avatar'),
'storage_capacity' => $request->storage_capacity, 'storage_capacity' => $request->storage_capacity,
'payment_activation' => 1, 'payment_activation' => 1,
]); ]);
+24 -23
View File
@@ -1,17 +1,16 @@
<?php <?php
namespace App\Http\Controllers\Oasis; namespace App\Http\Controllers\Oasis;
use App\Http\Requests\Oasis\StoreClientRequest;
use App\Http\Resources\Oasis\OasisClientCollection;
use App\Http\Controllers\Controller;
use App\Http\Resources\Oasis\OasisClientResource;
use App\Models\Oasis\Client;
use Auth; use Auth;
use Illuminate\Contracts\Foundation\Application; use App\Models\Oasis\Client;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
use App\Http\Requests\Oasis\StoreClientRequest;
use Illuminate\Contracts\Foundation\Application;
use App\Http\Resources\Oasis\OasisClientResource;
use Illuminate\Contracts\Routing\ResponseFactory;
use App\Http\Resources\Oasis\OasisClientCollection;
class ClientController extends Controller class ClientController extends Controller
{ {
@@ -21,7 +20,8 @@ class ClientController extends Controller
public function index() public function index()
{ {
return response( return response(
new OasisClientCollection(Auth::user()->clients), 200 new OasisClientCollection(Auth::user()->clients),
200
); );
} }
@@ -34,21 +34,22 @@ class ClientController extends Controller
$client = $request->user() $client = $request->user()
->clients() ->clients()
->create([ ->create([
'avatar' => store_avatar($request, 'avatar') ?? null, 'avatar' => store_avatar($request, 'avatar') ?? null,
'name' => $request->name, 'name' => $request->name,
'email' => $request->email ?? null, 'email' => $request->email ?? null,
'phone_number' => $request->phone_number ?? null, 'phone_number' => $request->phone_number ?? null,
'address' => $request->address, 'address' => $request->address,
'city' => $request->city, 'city' => $request->city,
'postal_code' => $request->postal_code, 'postal_code' => $request->postal_code,
'country' => $request->country, 'country' => $request->country,
'ico' => $request->ico ?? null, 'ico' => $request->ico ?? null,
'dic' => $request->dic ?? null, 'dic' => $request->dic ?? null,
'ic_dph' => $request->ic_dph ?? null, 'ic_dph' => $request->ic_dph ?? null,
]); ]);
return response( return response(
new OasisClientResource($client), 201 new OasisClientResource($client),
201
); );
} }
@@ -70,10 +71,9 @@ class ClientController extends Controller
{ {
// Store image if exist // Store image if exist
if ($request->hasFile($request->name)) { if ($request->hasFile($request->name)) {
// Find and update image path // Find and update image path
$client->update([ $client->update([
$request->name => store_avatar($request, $request->name) $request->name => store_avatar($request, $request->name),
]); ]);
return response('Done', 204); return response('Done', 204);
@@ -109,7 +109,8 @@ class ClientController extends Controller
->get(); ->get();
return response( return response(
new OasisClientCollection($results), 200 new OasisClientCollection($results),
200
); );
} }
} }
@@ -1,22 +1,20 @@
<?php <?php
namespace App\Http\Controllers\Oasis; namespace App\Http\Controllers\Oasis;
use App\Http\Controllers\Controller; use Auth;
use App\Http\Requests\Oasis\StoreInvoiceRequest; use Storage;
use App\Http\Resources\Oasis\OasisInvoiceCollection; use Illuminate\Support\Str;
use App\Http\Resources\Oasis\OasisInvoiceResource;
use App\Models\Oasis\Client; use App\Models\Oasis\Client;
use App\Models\Oasis\Invoice; use App\Models\Oasis\Invoice;
use App\Notifications\Oasis\InvoiceDeliveryNotification; use Illuminate\Http\Response;
use App\Notifications\SharedSendViaEmail; use App\Http\Controllers\Controller;
use Auth; use Illuminate\Support\Facades\Notification;
use App\Http\Requests\Oasis\StoreInvoiceRequest;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory; use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Response; use App\Http\Resources\Oasis\OasisInvoiceResource;
use Illuminate\Support\Facades\Notification; use App\Http\Resources\Oasis\OasisInvoiceCollection;
use Illuminate\Support\Str; use App\Notifications\Oasis\InvoiceDeliveryNotification;
use Storage;
class InvoiceController extends Controller class InvoiceController extends Controller
{ {
@@ -26,7 +24,8 @@ class InvoiceController extends Controller
public function get_all_regular_invoices() public function get_all_regular_invoices()
{ {
return response( return response(
new OasisInvoiceCollection(Auth::user()->regularInvoices), 200 new OasisInvoiceCollection(Auth::user()->regularInvoices),
200
); );
} }
@@ -36,7 +35,8 @@ class InvoiceController extends Controller
public function get_all_advance_invoices() public function get_all_advance_invoices()
{ {
return response( return response(
new OasisInvoiceCollection(Auth::user()->advanceInvoices), 200 new OasisInvoiceCollection(Auth::user()->advanceInvoices),
200
); );
} }
@@ -46,7 +46,7 @@ class InvoiceController extends Controller
*/ */
public function get_invoice(Invoice $invoice) public function get_invoice(Invoice $invoice)
{ {
if (!Storage::exists(invoice_path($invoice))) { if (! Storage::exists(invoice_path($invoice))) {
abort(404, 'Not Found'); abort(404, 'Not Found');
} }
@@ -66,7 +66,8 @@ class InvoiceController extends Controller
->get(); ->get();
return response( return response(
new OasisInvoiceCollection($results), 200 new OasisInvoiceCollection($results),
200
); );
} }
@@ -82,33 +83,33 @@ class InvoiceController extends Controller
$user = $request->user(); $user = $request->user();
$invoice = Invoice::create([ $invoice = Invoice::create([
'user_id' => $user->id, 'user_id' => $user->id,
'client_id' => $client->id ?? null, 'client_id' => $client->id ?? null,
'invoice_type' => $request->invoice_type, 'invoice_type' => $request->invoice_type,
'invoice_number' => $request->invoice_number, 'invoice_number' => $request->invoice_number,
'variable_number' => $request->variable_number, 'variable_number' => $request->variable_number,
'delivery_at' => $request->delivery_at, 'delivery_at' => $request->delivery_at,
'discount_type' => $request->discount_type ?? null, 'discount_type' => $request->discount_type ?? null,
'discount_rate' => $request->discount_rate ?? null, 'discount_rate' => $request->discount_rate ?? null,
'items' => $request->items, 'items' => $request->items,
'user' => $user->invoiceProfile, 'user' => $user->invoiceProfile,
'client' => [ 'client' => [
'email' => $client->email ?? $request->client_email, 'email' => $client->email ?? $request->client_email,
'name' => $client->name ?? $request->client_name, 'name' => $client->name ?? $request->client_name,
'address' => $client->address ?? $request->client_address, 'address' => $client->address ?? $request->client_address,
'city' => $client->city ?? $request->client_city, 'city' => $client->city ?? $request->client_city,
'postal_code' => $client->postal_code ?? $request->client_postal_code, 'postal_code' => $client->postal_code ?? $request->client_postal_code,
'country' => $client->country ?? $request->client_country, 'country' => $client->country ?? $request->client_country,
'ico' => $client->ico ?? $request->client_ico, 'ico' => $client->ico ?? $request->client_ico,
'dic' => $client->dic ?? $request->client_dic ?? null, 'dic' => $client->dic ?? $request->client_dic ?? null,
'ic_dph' => $client->ic_dph ?? $request->client_ic_dph ?? null, 'ic_dph' => $client->ic_dph ?? $request->client_ic_dph ?? null,
], ],
]); ]);
// Generate PDF // Generate PDF
\PDF::loadView('oasis.invoices.invoice', [ \PDF::loadView('oasis.invoices.invoice', [
'invoice' => Invoice::find($invoice->id), 'invoice' => Invoice::find($invoice->id),
'user' => $user, 'user' => $user,
]) ])
->setPaper('a4') ->setPaper('a4')
->setOrientation('portrait') ->setOrientation('portrait')
@@ -123,7 +124,8 @@ class InvoiceController extends Controller
} }
return response( return response(
new OasisInvoiceResource($invoice), 201 new OasisInvoiceResource($invoice),
201
); );
} }
@@ -144,22 +146,21 @@ class InvoiceController extends Controller
*/ */
private function getOrStoreClient(StoreInvoiceRequest $request) private function getOrStoreClient(StoreInvoiceRequest $request)
{ {
if (!Str::isUuid($request->client) && $request->store_client) { if (! Str::isUuid($request->client) && $request->store_client) {
return $request->user() return $request->user()
->clients() ->clients()
->create([ ->create([
'avatar' => store_avatar($request, 'client_avatar') ?? null, 'avatar' => store_avatar($request, 'client_avatar') ?? null,
'name' => $request->client_name, 'name' => $request->client_name,
'email' => $request->client_email ?? null, 'email' => $request->client_email ?? null,
'phone_number' => $request->client_phone_number ?? null, 'phone_number' => $request->client_phone_number ?? null,
'address' => $request->client_address, 'address' => $request->client_address,
'city' => $request->client_city, 'city' => $request->client_city,
'postal_code' => $request->client_postal_code, 'postal_code' => $request->client_postal_code,
'country' => $request->client_country, 'country' => $request->client_country,
'ico' => $request->client_ico ?? null, 'ico' => $request->client_ico ?? null,
'dic' => $request->client_dic ?? null, 'dic' => $request->client_dic ?? null,
'ic_dph' => $request->client_ic_dph ?? null, 'ic_dph' => $request->client_ic_dph ?? null,
]); ]);
} }
@@ -1,16 +1,14 @@
<?php <?php
namespace App\Http\Controllers\Oasis; namespace App\Http\Controllers\Oasis;
use App\Http\Controllers\Controller;
use App\Http\Resources\Oasis\InvoiceProfileResource;
use App\Models\Oasis\InvoiceProfile;
use App\Models\Setting;
use Auth; use Auth;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use App\Http\Controllers\Controller;
use App\Models\Oasis\InvoiceProfile;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use App\Http\Resources\Oasis\InvoiceProfileResource;
class InvoiceProfileController extends Controller class InvoiceProfileController extends Controller
{ {
@@ -20,9 +18,11 @@ class InvoiceProfileController extends Controller
public function show() public function show()
{ {
return response( return response(
new InvoiceProfileResource(Auth::user()->invoiceProfile), 200 new InvoiceProfileResource(Auth::user()->invoiceProfile),
200
); );
} }
/** /**
* @param Request $request * @param Request $request
* @return Application|ResponseFactory|Response * @return Application|ResponseFactory|Response
@@ -30,29 +30,30 @@ class InvoiceProfileController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$profile = InvoiceProfile::create([ $profile = InvoiceProfile::create([
'user_id' => $request->user()->id, 'user_id' => $request->user()->id,
'logo' => store_system_image($request, 'logo') ?? null, 'logo' => store_system_image($request, 'logo') ?? null,
'stamp' => store_system_image($request, 'stamp') ?? null, 'stamp' => store_system_image($request, 'stamp') ?? null,
'company' => $request->company, 'company' => $request->company,
'email' => $request->email, 'email' => $request->email,
'ico' => $request->ico, 'ico' => $request->ico,
'dic' => $request->dic, 'dic' => $request->dic,
'ic_dph' => $request->ic_dph, 'ic_dph' => $request->ic_dph,
'registration_notes' => $request->registration_notes, 'registration_notes' => $request->registration_notes,
'author' => $request->author, 'author' => $request->author,
'address' => $request->address, 'address' => $request->address,
'state' => $request->state, 'state' => $request->state,
'city' => $request->city, 'city' => $request->city,
'postal_code' => $request->postal_code, 'postal_code' => $request->postal_code,
'country' => $request->country, 'country' => $request->country,
'phone' => $request->phone, 'phone' => $request->phone,
'bank' => $request->bank, 'bank' => $request->bank,
'iban' => $request->iban, 'iban' => $request->iban,
'swift' => $request->swift, 'swift' => $request->swift,
]); ]);
return response( return response(
new InvoiceProfileResource($profile), 201 new InvoiceProfileResource($profile),
201
); );
} }
@@ -64,12 +65,11 @@ class InvoiceProfileController extends Controller
{ {
// Store image if exist // Store image if exist
if ($request->hasFile($request->name)) { if ($request->hasFile($request->name)) {
// Find and update image path // Find and update image path
$request->user() $request->user()
->invoiceProfile() ->invoiceProfile()
->update([ ->update([
$request->name => store_system_image($request, $request->name) $request->name => store_system_image($request, $request->name),
]); ]);
return response('Done', 204); return response('Done', 204);
@@ -1,20 +1,17 @@
<?php <?php
namespace App\Http\Controllers\Oasis; namespace App\Http\Controllers\Oasis;
use App\Http\Controllers\Controller;
use App\Http\Requests\User\UpdateUserPasswordRequest;
use App\Http\Resources\Oasis\SubscriptionRequestResource;
use App\Http\Resources\PlanResource;
use App\Models\Oasis\SubscriptionRequest;
use App\Services\StripeService;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use App\Services\StripeService;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use App\Models\Oasis\SubscriptionRequest;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\ResponseFactory;
use App\Http\Requests\User\UpdateUserPasswordRequest;
use App\Http\Resources\Oasis\SubscriptionRequestResource;
class SubscriptionController extends Controller class SubscriptionController extends Controller
{ {
@@ -32,7 +29,8 @@ class SubscriptionController extends Controller
public function get_subscription_request(SubscriptionRequest $order) public function get_subscription_request(SubscriptionRequest $order)
{ {
return response( return response(
new SubscriptionRequestResource($order), 200 new SubscriptionRequestResource($order),
200
); );
} }
@@ -62,7 +60,6 @@ class SubscriptionController extends Controller
{ {
// Make subscription from subscription request // Make subscription from subscription request
if ($order->exists) { if ($order->exists) {
// Create subscription // Create subscription
$order->user $order->user
->newSubscription('main', $order->requested_plan) ->newSubscription('main', $order->requested_plan)
@@ -77,7 +74,7 @@ class SubscriptionController extends Controller
} }
// Make subscription after user sign up and pay for the plan // Make subscription after user sign up and pay for the plan
if (!$order->exists) { if (! $order->exists) {
$user = Auth::user(); $user = Auth::user();
// Set user billing // Set user billing
@@ -99,7 +96,7 @@ class SubscriptionController extends Controller
$user $user
->settings() ->settings()
->update([ ->update([
'storage_capacity' => $plan['product']['metadata']['capacity'], 'storage_capacity' => $plan['product']['metadata']['capacity'],
'payment_activation' => 1, 'payment_activation' => 1,
]); ]);
@@ -126,7 +123,7 @@ class SubscriptionController extends Controller
// Update status // Update status
$order->update([ $order->update([
'status' => 'logged' 'status' => 'logged',
]); ]);
// Log in user // Log in user
+9 -10
View File
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Requests\Oasis; namespace App\Http\Requests\Oasis;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
@@ -24,16 +23,16 @@ class CreateOrderRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'ico' => 'sometimes|nullable', 'ico' => 'sometimes|nullable',
'name' => 'required|string', 'name' => 'required|string',
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
'phone_number' => 'string|nullable', 'phone_number' => 'string|nullable',
'address' => 'required|string', 'address' => 'required|string',
'state' => 'required|string', 'state' => 'required|string',
'city' => 'required|string', 'city' => 'required|string',
'postal_code' => 'required|string', 'postal_code' => 'required|string',
'country' => 'required|string', 'country' => 'required|string',
'plan' => 'required|string', 'plan' => 'required|string',
]; ];
} }
} }
+10 -11
View File
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Requests\Oasis; namespace App\Http\Requests\Oasis;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
@@ -24,17 +23,17 @@ class StoreClientRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'avatar' => 'sometimes|nullable', 'avatar' => 'sometimes|nullable',
'name' => 'required|string', 'name' => 'required|string',
'email' => 'sometimes|email|nullable', 'email' => 'sometimes|email|nullable',
'phone_number' => 'sometimes|string|nullable', 'phone_number' => 'sometimes|string|nullable',
'address' => 'required|string', 'address' => 'required|string',
'city' => 'required|string', 'city' => 'required|string',
'postal_code' => 'required|string', 'postal_code' => 'required|string',
'country' => 'required|string', 'country' => 'required|string',
'ico' => 'required|string', 'ico' => 'required|string',
'dic' => 'required|string|nullable', 'dic' => 'required|string|nullable',
'ic_dph' => 'sometimes|string|nullable', 'ic_dph' => 'sometimes|string|nullable',
]; ];
} }
} }
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Requests\Oasis; namespace App\Http\Requests\Oasis;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
@@ -24,24 +23,24 @@ class StoreInvoiceProfileRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'logo' => 'sometimes|file', 'logo' => 'sometimes|file',
'stamp' => 'sometimes|file', 'stamp' => 'sometimes|file',
'company' => 'required|string', 'company' => 'required|string',
'email' => 'required|email', 'email' => 'required|email',
'ico' => 'sometimes|string|nullable', 'ico' => 'sometimes|string|nullable',
'dic' => 'sometimes|string|nullable', 'dic' => 'sometimes|string|nullable',
'ic_dph' => 'sometimes|string|nullable', 'ic_dph' => 'sometimes|string|nullable',
'registration_notes' => 'sometimes|string|nullable', 'registration_notes' => 'sometimes|string|nullable',
'author' => 'required|string', 'author' => 'required|string',
'address' => 'required|string', 'address' => 'required|string',
'state' => 'required|string', 'state' => 'required|string',
'city' => 'required|string', 'city' => 'required|string',
'postal_code' => 'required|string', 'postal_code' => 'required|string',
'country' => 'required|string', 'country' => 'required|string',
'phone' => 'required|string', 'phone' => 'required|string',
'bank' => 'required|string', 'bank' => 'required|string',
'iban' => 'required|string', 'iban' => 'required|string',
'swift' => 'required|string', 'swift' => 'required|string',
]; ];
} }
} }
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Requests\Oasis; namespace App\Http\Requests\Oasis;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
@@ -24,14 +23,14 @@ class StoreInvoiceRequest extends FormRequest
public function rules() public function rules()
{ {
return [ return [
'invoice_type' => 'required|string', 'invoice_type' => 'required|string',
'invoice_number' => 'required|string', 'invoice_number' => 'required|string',
'variable_number' => 'required|string', 'variable_number' => 'required|string',
'client' => 'required', 'client' => 'required',
'items' => 'required|array', 'items' => 'required|array',
'discount_type' => 'sometimes|string', 'discount_type' => 'sometimes|string',
'discount_rate' => 'sometimes|integer', 'discount_rate' => 'sometimes|integer',
'delivery_at' => 'required|date', 'delivery_at' => 'required|date',
]; ];
} }
} }
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@@ -16,27 +15,27 @@ class InvoiceProfileResource extends JsonResource
{ {
return [ return [
'data' => [ 'data' => [
'id' => $this->id, 'id' => $this->id,
'type' => 'invoice-profile', 'type' => 'invoice-profile',
'attributes' => [ 'attributes' => [
'logo' => $this->logo, 'logo' => $this->logo,
'stamp' => $this->stamp, 'stamp' => $this->stamp,
'company' => $this->company, 'company' => $this->company,
'email' => $this->email, 'email' => $this->email,
'ico' => $this->ico, 'ico' => $this->ico,
'dic' => $this->dic, 'dic' => $this->dic,
'ic_dph' => $this->ic_dph, 'ic_dph' => $this->ic_dph,
'registration_notes' => $this->registration_notes, 'registration_notes' => $this->registration_notes,
'author' => $this->author, 'author' => $this->author,
'address' => $this->address, 'address' => $this->address,
'state' => $this->state, 'state' => $this->state,
'city' => $this->city, 'city' => $this->city,
'postal_code' => $this->postal_code, 'postal_code' => $this->postal_code,
'country' => $this->country, 'country' => $this->country,
'phone' => $this->phone, 'phone' => $this->phone,
'bank' => $this->bank, 'bank' => $this->bank,
'iban' => $this->iban, 'iban' => $this->iban,
'swift' => $this->swift, 'swift' => $this->swift,
], ],
], ],
]; ];
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
@@ -23,24 +22,24 @@ class OasisClientResource extends JsonResource
->count(); ->count();
return [ return [
'id' => $this->id, 'id' => $this->id,
'type' => 'client', 'type' => 'client',
'created_at' => format_date($this->created_at, '%d. %B %Y'), 'created_at' => format_date($this->created_at, '%d. %B %Y'),
'totalNet' => format_to_currency($total_net, 'CZK'), 'totalNet' => format_to_currency($total_net, 'CZK'),
'totalInvoices' => $total_invoices, 'totalInvoices' => $total_invoices,
'avatar' => $this->avatar, 'avatar' => $this->avatar,
'name' => $this->name, 'name' => $this->name,
'email' => $this->email, 'email' => $this->email,
'phone_number' => $this->phone_number, 'phone_number' => $this->phone_number,
'address' => $this->address, 'address' => $this->address,
'city' => $this->city, 'city' => $this->city,
'postal_code' => $this->postal_code, 'postal_code' => $this->postal_code,
'country' => $this->country, 'country' => $this->country,
'ico' => $this->ico, 'ico' => $this->ico,
'dic' => $this->dic, 'dic' => $this->dic,
'ic_dph' => $this->ic_dph, 'ic_dph' => $this->ic_dph,
]; ];
} }
} }
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\ResourceCollection; use Illuminate\Http\Resources\Json\ResourceCollection;
@@ -1,10 +1,7 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class OasisInvoiceResource extends JsonResource class OasisInvoiceResource extends JsonResource
{ {
@@ -17,15 +14,15 @@ class OasisInvoiceResource extends JsonResource
public function toArray($request) public function toArray($request)
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency), 'name' => $this->client['name'] . ' ' . format_to_currency($this->total_net, $this->currency),
'invoiceNumber' => $this->invoice_number, 'invoiceNumber' => $this->invoice_number,
'total' => format_to_currency($this->total_net, $this->currency), 'total' => format_to_currency($this->total_net, $this->currency),
'file_url' => "/oasis/invoice/$this->id", 'file_url' => "/oasis/invoice/$this->id",
'clientName' => $this->client['name'], 'clientName' => $this->client['name'],
'mimetype' => 'pdf', 'mimetype' => 'pdf',
'type' => 'invoice', 'type' => 'invoice',
'created_at' => format_date($this->created_at, '%d. %B. %Y'), 'created_at' => format_date($this->created_at, '%d. %B. %Y'),
]; ];
} }
} }
@@ -1,12 +1,9 @@
<?php <?php
namespace App\Http\Resources\Oasis; namespace App\Http\Resources\Oasis;
use App\Http\Resources\PlanResource;
use App\Http\Resources\PricingResource;
use App\Services\StripeService; use App\Services\StripeService;
use App\Http\Resources\PricingResource;
use Illuminate\Http\Resources\Json\JsonResource; use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Cache;
class SubscriptionRequestResource extends JsonResource class SubscriptionRequestResource extends JsonResource
{ {
@@ -20,34 +17,34 @@ class SubscriptionRequestResource extends JsonResource
{ {
return [ return [
'data' => [ 'data' => [
'id' => $this->id, 'id' => $this->id,
'type' => 'subscription-requests', 'type' => 'subscription-requests',
'attributes' => [ 'attributes' => [
'requested_plan' => $this->requested_plan, 'requested_plan' => $this->requested_plan,
'status' => $this->status, 'status' => $this->status,
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'), 'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
], ],
'relationships' => [ 'relationships' => [
'user' => [ 'user' => [
'data' => [ 'data' => [
'id' => $this->user->id, 'id' => $this->user->id,
'type' => 'users', 'type' => 'users',
'attributes' => [ 'attributes' => [
'name' => $this->user->settings->name, 'name' => $this->user->settings->name,
'address' => $this->user->settings->address, 'address' => $this->user->settings->address,
'state' => $this->user->settings->state, 'state' => $this->user->settings->state,
'city' => $this->user->settings->city, 'city' => $this->user->settings->city,
'postal_code' => $this->user->settings->postal_code, 'postal_code' => $this->user->settings->postal_code,
'country' => $this->user->settings->country, 'country' => $this->user->settings->country,
'phone_number' => $this->user->settings->phone_number, 'phone_number' => $this->user->settings->phone_number,
'ico' => $this->user->settings->ico, 'ico' => $this->user->settings->ico,
] ],
] ],
], ],
'plan' => new PricingResource( 'plan' => new PricingResource(
resolve(StripeService::class)->getPlan($this->requested_plan) resolve(StripeService::class)->getPlan($this->requested_plan)
), ),
] ],
], ],
]; ];
} }
+1 -1
View File
@@ -48,7 +48,7 @@ class UserResource extends JsonResource
'timezone' => $this->settings->timezone, 'timezone' => $this->settings->timezone,
// OasisDrive // OasisDrive
'payment_activation' => (integer) $this->settings->payment_activation 'payment_activation' => (integer) $this->settings->payment_activation,
], ],
], ],
], ],
+1 -3
View File
@@ -21,7 +21,7 @@ function base64_from_storage_image($filepath)
return null; return null;
} }
if (!Storage::exists($filepath)) { if (! Storage::exists($filepath)) {
return null; return null;
} }
@@ -84,7 +84,6 @@ function invoice_total_discount($invoice, $format = false)
{ {
// Percent discount // Percent discount
if ($invoice['discount_type'] === 'percent') { if ($invoice['discount_type'] === 'percent') {
$discount = (int) (invoice_total_net($invoice) + invoice_total_tax($invoice)) * ($invoice['discount_rate'] / 100); $discount = (int) (invoice_total_net($invoice) + invoice_total_tax($invoice)) * ($invoice['discount_rate'] / 100);
if ($format) { if ($format) {
@@ -96,7 +95,6 @@ function invoice_total_discount($invoice, $format = false)
// Value discount // Value discount
if ($invoice['discount_type'] === 'value') { if ($invoice['discount_type'] === 'value') {
if ($format) { if ($format) {
return Cashier::formatAmount($invoice['discount_rate'] * 100, $invoice['currency'], 'cs'); return Cashier::formatAmount($invoice['discount_rate'] * 100, $invoice['currency'], 'cs');
} }
+1 -3
View File
@@ -291,7 +291,6 @@ function store_avatar($request, $name)
$image_path = Str::random(16) . '-' . $image->getClientOriginalName(); $image_path = Str::random(16) . '-' . $image->getClientOriginalName();
if (in_array($image->getClientMimeType(), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) { if (in_array($image->getClientMimeType(), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) {
// Create intervention image // Create intervention image
$img = Image::make($image->getRealPath()); $img = Image::make($image->getRealPath());
@@ -303,8 +302,7 @@ function store_avatar($request, $name)
} }
if ($image->getClientMimeType() === 'image/svg+xml') { if ($image->getClientMimeType() === 'image/svg+xml') {
Storage::putFileAs('avatars', $image, $image_path);
Storage::putFileAs("avatars", $image, $image_path);
} }
// Return path to image // Return path to image
+8 -9
View File
@@ -1,14 +1,13 @@
<?php <?php
namespace App\Models\Oasis; namespace App\Models\Oasis;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Laravel\Scout\Searchable; use Laravel\Scout\Searchable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use TeamTNT\TNTSearch\Indexer\TNTIndexer; use TeamTNT\TNTSearch\Indexer\TNTIndexer;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/** /**
* @method static whereUserId($id) * @method static whereUserId($id)
@@ -66,11 +65,11 @@ class Client extends Model
$client_email = Str::slug($array['email'], ' '); $client_email = Str::slug($array['email'], ' ');
return [ return [
'id' => $this->id, 'id' => $this->id,
'clientName' => $array['name'], 'clientName' => $array['name'],
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))), 'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
'clientEmail' => $array['email'], 'clientEmail' => $array['email'],
'clientEmailNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_email]))), 'clientEmailNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_email]))),
]; ];
} }
+12 -14
View File
@@ -1,29 +1,27 @@
<?php <?php
namespace App\Models\Oasis; namespace App\Models\Oasis;
use App\Models\User;
use Auth;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Laravel\Scout\Searchable; use Laravel\Scout\Searchable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use TeamTNT\TNTSearch\Indexer\TNTIndexer; use TeamTNT\TNTSearch\Indexer\TNTIndexer;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Invoice extends Model class Invoice extends Model
{ {
use HasFactory, Searchable; use HasFactory, Searchable;
protected $casts = [ protected $casts = [
'items' => 'array', 'items' => 'array',
'user' => 'array', 'user' => 'array',
'client' => 'array', 'client' => 'array',
]; ];
public $guarded = [ public $guarded = [
'id' 'id',
]; ];
public $incrementing = false; public $incrementing = false;
@@ -47,10 +45,10 @@ class Invoice extends Model
$client_name = Str::slug($array['client']['name'], ' '); $client_name = Str::slug($array['client']['name'], ' ');
return [ return [
'id' => $this->id, 'id' => $this->id,
'clientName' => $array['client']['name'], 'clientName' => $array['client']['name'],
'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))), 'clientNameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$client_name]))),
'invoiceNumber' => $array['invoice_number'], 'invoiceNumber' => $array['invoice_number'],
'invoiceNumberNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$array['invoice_number']]))), 'invoiceNumberNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$array['invoice_number']]))),
]; ];
} }
@@ -60,7 +58,7 @@ class Invoice extends Model
parent::boot(); parent::boot();
static::creating(function ($invoice) { static::creating(function ($invoice) {
$invoice->id = (string)Str::uuid(); $invoice->id = (string) Str::uuid();
$invoice->delivery_at = $invoice->created_at; $invoice->delivery_at = $invoice->created_at;
$invoice->due_at = Carbon::parse($invoice->created_at)->addWeeks(2); $invoice->due_at = Carbon::parse($invoice->created_at)->addWeeks(2);
+2 -3
View File
@@ -1,11 +1,10 @@
<?php <?php
namespace App\Models\Oasis; namespace App\Models\Oasis;
use App\Models\User; use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class InvoiceProfile extends Model class InvoiceProfile extends Model
{ {
+5 -6
View File
@@ -1,19 +1,18 @@
<?php <?php
namespace App\Models\Oasis; namespace App\Models\Oasis;
use App\Models\User;
use Auth; use Auth;
use Illuminate\Database\Eloquent\Factories\HasFactory; use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class SubscriptionRequest extends Model class SubscriptionRequest extends Model
{ {
use HasFactory; use HasFactory;
protected $fillable = [ protected $fillable = [
'requested_plan', 'creator', 'status' 'requested_plan', 'creator', 'status',
]; ];
public $incrementing = false; public $incrementing = false;
@@ -30,7 +29,7 @@ class SubscriptionRequest extends Model
parent::boot(); parent::boot();
static::creating(function ($order) { static::creating(function ($order) {
$order->id = (string)Str::uuid(); $order->id = (string) Str::uuid();
$order->creator = Auth::user()->email ?? $order->creator; $order->creator = Auth::user()->email ?? $order->creator;
}); });
} }
-2
View File
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Models; namespace App\Models;
use App\Traits\Oasis; use App\Traits\Oasis;
@@ -18,7 +17,6 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable class User extends Authenticatable
{ {
use Notifiable, Billable, Sortable, HasFactory, HasApiTokens; use Notifiable, Billable, Sortable, HasFactory, HasApiTokens;
use Oasis; use Oasis;
protected $guarded = [ protected $guarded = [
@@ -1,12 +1,9 @@
<?php <?php
namespace App\Notifications\Oasis; namespace App\Notifications\Oasis;
use App\Models\Oasis\Invoice;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification; use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class InvoiceDeliveryNotification extends Notification class InvoiceDeliveryNotification extends Notification
{ {
@@ -51,7 +48,7 @@ class InvoiceDeliveryNotification extends Notification
->greeting(__t('mail_greeting')) ->greeting(__t('mail_greeting'))
->line($this->user->settings->name . ' sent you an invoice.') ->line($this->user->settings->name . ' sent you an invoice.')
->salutation(__t('mail_salutation')) ->salutation(__t('mail_salutation'))
->attach(storage_path("app/" . invoice_path($this->invoice)), [ ->attach(storage_path('app/' . invoice_path($this->invoice)), [
'as' => 'name.pdf', 'as' => 'name.pdf',
'mime' => 'application/pdf', 'mime' => 'application/pdf',
]); ]);
@@ -66,7 +63,6 @@ class InvoiceDeliveryNotification extends Notification
public function toArray($notifiable) public function toArray($notifiable)
{ {
return [ return [
//
]; ];
} }
} }
@@ -1,12 +1,10 @@
<?php <?php
namespace App\Notifications\Oasis; namespace App\Notifications\Oasis;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Laravel\Cashier\Cashier; use Laravel\Cashier\Cashier;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class PaymentRequiredNotification extends Notification class PaymentRequiredNotification extends Notification
{ {
@@ -50,9 +48,9 @@ class PaymentRequiredNotification extends Notification
->greeting(__t('mail_greeting')) ->greeting(__t('mail_greeting'))
->line(__t('mail_order_line_1')) ->line(__t('mail_order_line_1'))
->line(__t('mail_tariff', [ ->line(__t('mail_tariff', [
'name' => $this->plan['product']['name'], 'name' => $this->plan['product']['name'],
'storage' => Cashier::formatAmount($this->plan['plan']['amount']), 'storage' => Cashier::formatAmount($this->plan['plan']['amount']),
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']), 'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
])) ]))
->action(__t('mail_activation_action'), $url) ->action(__t('mail_activation_action'), $url)
->line(__t('mail_order_line_2')) ->line(__t('mail_order_line_2'))
@@ -69,7 +67,6 @@ class PaymentRequiredNotification extends Notification
public function toArray($notifiable) public function toArray($notifiable)
{ {
return [ return [
//
]; ];
} }
} }
@@ -1,12 +1,10 @@
<?php <?php
namespace App\Notifications\Oasis; namespace App\Notifications\Oasis;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Laravel\Cashier\Cashier; use Laravel\Cashier\Cashier;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class ReminderForPaymentRequiredNotification extends Notification class ReminderForPaymentRequiredNotification extends Notification
{ {
@@ -50,9 +48,9 @@ class ReminderForPaymentRequiredNotification extends Notification
->greeting(__t('mail_greeting')) ->greeting(__t('mail_greeting'))
->line(__t('mail_reminder_line_1')) ->line(__t('mail_reminder_line_1'))
->line(__t('mail_tariff', [ ->line(__t('mail_tariff', [
'name' => $this->plan['product']['name'], 'name' => $this->plan['product']['name'],
'storage' => Cashier::formatAmount($this->plan['plan']['amount']), 'storage' => Cashier::formatAmount($this->plan['plan']['amount']),
'price' => format_gigabytes($this->plan['product']['metadata']['capacity']), 'price' => format_gigabytes($this->plan['product']['metadata']['capacity']),
])) ]))
->line(__t('mail_reminder_line_2')) ->line(__t('mail_reminder_line_2'))
->action(__t('mail_activation_action'), $url) ->action(__t('mail_activation_action'), $url)
@@ -69,7 +67,6 @@ class ReminderForPaymentRequiredNotification extends Notification
public function toArray($notifiable) public function toArray($notifiable)
{ {
return [ return [
//
]; ];
} }
} }
@@ -22,7 +22,6 @@
* $out = $connector->findByIco('44315945'); * $out = $connector->findByIco('44315945');
* echo ''.print_r($out, 1).''; * echo ''.print_r($out, 1).'';
*/ */
namespace App\Services\Oasis; namespace App\Services\Oasis;
class CzechRegisterSearchService class CzechRegisterSearchService
@@ -85,9 +84,11 @@ class CzechRegisterSearchService
if (preg_match('/^\d{8}$/', $ico)) { if (preg_match('/^\d{8}$/', $ico)) {
$url = self::URL_SERVER . '?ico=' . $ico; $url = self::URL_SERVER . '?ico=' . $ico;
$response = file_get_contents($url); $response = file_get_contents($url);
if ($response) { if ($response) {
$response = self::extractSubjects($response); $response = self::extractSubjects($response);
if (!empty($response[0])) {
if (! empty($response[0])) {
$response = $response[0]; $response = $response[0];
} }
} }
@@ -96,7 +97,6 @@ class CzechRegisterSearchService
return $response; return $response;
} }
/** /**
* Return matched formatted for autocomplete dropdown list * Return matched formatted for autocomplete dropdown list
* @param string $term Searched matching string * @param string $term Searched matching string
@@ -116,8 +116,7 @@ class CzechRegisterSearchService
} }
} }
if (!empty($subjects) && is_array($subjects)) { if (! empty($subjects) && is_array($subjects)) {
$subjects = array_slice($subjects, 0, $size); // return first $size matches $subjects = array_slice($subjects, 0, $size); // return first $size matches
foreach ($subjects as &$subject) { foreach ($subjects as &$subject) {
@@ -129,7 +128,7 @@ class CzechRegisterSearchService
} }
foreach ($subjects as $subject) { foreach ($subjects as $subject) {
if (!empty($subject['ico'])) { if (! empty($subject['ico'])) {
$out[] = [ $out[] = [
'value' => $subject['ico'], 'value' => $subject['ico'],
'label' => "{$subject['shortname']} (IČO: {$subject['ico']})", 'label' => "{$subject['shortname']} (IČO: {$subject['ico']})",
@@ -149,15 +148,15 @@ class CzechRegisterSearchService
protected static function extractSubjects($html) protected static function extractSubjects($html)
{ {
// ensure valid XHTML markup // ensure valid XHTML markup
if (!extension_loaded('tidy')) { if (! extension_loaded('tidy')) {
throw new \Exception('Missing extension [tidy].'); throw new \Exception('Missing extension [tidy].');
} }
$tidy = new \tidy(); $tidy = new \tidy();
$html = $tidy->repairString($html, array( $html = $tidy->repairString($html, [
'output-xhtml' => true, 'output-xhtml' => true,
'show-body-only' => true, 'show-body-only' => true,
), 'utf8'); ], 'utf8');
// purify whitespaces - vkladaju \n alebo // purify whitespaces - vkladaju \n alebo
$html = strtr($html, [ $html = strtr($html, [
@@ -174,26 +173,25 @@ class CzechRegisterSearchService
$out = []; $out = [];
if ($rows->length) { if ($rows->length) {
foreach ($rows as $row) { foreach ($rows as $row) {
// Nazev // Nazev
$nodeList = $xpath->query("./tr[1]/td[1]", $row); $nodeList = $xpath->query('./tr[1]/td[1]', $row);
if (!$nodeList->length) {
if (! $nodeList->length) {
continue; // nazev je povinny continue; // nazev je povinny
} }
$name = $nodeList->item(0)->nodeValue; $name = $nodeList->item(0)->nodeValue;
$name = preg_replace('/\s+/', ' ', $name); // viacnasobne inside spaces $name = preg_replace('/\s+/', ' ', $name); // viacnasobne inside spaces
// ICO // ICO
$nodeList = $xpath->query("./tr[1]/td[2]", $row); $nodeList = $xpath->query('./tr[1]/td[2]', $row);
$ico = $nodeList->length ? $nodeList->item(0)->nodeValue : ''; $ico = $nodeList->length ? $nodeList->item(0)->nodeValue : '';
// adresa - neda sa spolahnut na poradie prvkov :-( // adresa - neda sa spolahnut na poradie prvkov :-(
$city = ''; $city = '';
$nodeList = $xpath->query("./tr[3]/td[1]", $row); $nodeList = $xpath->query('./tr[3]/td[1]', $row);
if ($nodeList->length) {
if ($nodeList->length) {
$addr = trim($nodeList->item(0)->nodeValue); $addr = trim($nodeList->item(0)->nodeValue);
if (preg_match('/,\s*(\d{3} ?\d{2})\s+(.+)$/', $addr, $match)) { if (preg_match('/,\s*(\d{3} ?\d{2})\s+(.+)$/', $addr, $match)) {
@@ -206,9 +204,10 @@ class CzechRegisterSearchService
list($city, $addr_streetnr) = explode(',', $addr); list($city, $addr_streetnr) = explode(',', $addr);
$addr_city = $city; $addr_city = $city;
$addr_zip = $match[1]; $addr_zip = $match[1];
} elseif (!preg_match('/\d{3} ?\d{2}/', $addr, $match)) { } elseif (! preg_match('/\d{3} ?\d{2}/', $addr, $match)) {
// Ústí nad Labem, Masarykova 74 - bez PSC - obec, ulice a cislo // Ústí nad Labem, Masarykova 74 - bez PSC - obec, ulice a cislo
$addr_streetnr = $addr_zip = ''; $addr_streetnr = $addr_zip = '';
if (false !== strpos($addr, ',')) { if (false !== strpos($addr, ',')) {
list($city, $addr_streetnr) = explode(',', $addr); list($city, $addr_streetnr) = explode(',', $addr);
} else { } else {
@@ -227,15 +226,15 @@ class CzechRegisterSearchService
} }
$out[] = [ $out[] = [
'name' => self::trimQuotes($name), 'name' => self::trimQuotes($name),
'ico' => preg_replace('/[^\d]/', '', $ico), 'ico' => preg_replace('/[^\d]/', '', $ico),
'city' => self::trimQuotes($city), 'city' => self::trimQuotes($city),
// pre polia s adresou konzistentne so smartform naseptavacem // pre polia s adresou konzistentne so smartform naseptavacem
'addr_city' => self::trimQuotes($addr_city), 'addr_city' => self::trimQuotes($addr_city),
'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip), 'addr_zip' => preg_replace('/[^\d]/', '', $addr_zip),
'addr_streetnr' => self::trimQuotes($addr_streetnr), 'addr_streetnr' => self::trimQuotes($addr_streetnr),
// len pre kontrolu - plna povodna adresa // len pre kontrolu - plna povodna adresa
'addr_full' => self::trimQuotes($addr), 'addr_full' => self::trimQuotes($addr),
]; ];
} }
} }
@@ -251,5 +250,4 @@ class CzechRegisterSearchService
{ {
return trim(strtr($s, ['"' => '', "'" => ''])); return trim(strtr($s, ['"' => '', "'" => '']));
} }
} }
+3 -8
View File
@@ -1,16 +1,11 @@
<?php <?php
namespace App\Services\Oasis; namespace App\Services\Oasis;
use App\Models\Oasis\Client;
use App\Models\Oasis\Invoice;
use App\Models\User; use App\Models\User;
use Illuminate\Contracts\Foundation\Application; use App\Models\Oasis\Invoice;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Factories\Sequence; use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\Foundation\Application;
class OasisDevService class OasisDevService
{ {
+4 -8
View File
@@ -1,13 +1,10 @@
<?php <?php
namespace App\Services\Oasis; namespace App\Services\Oasis;
use Carbon\Carbon;
use App\Services\StripeService;
use App\Models\Oasis\SubscriptionRequest; use App\Models\Oasis\SubscriptionRequest;
use App\Notifications\Oasis\ReminderForPaymentRequiredNotification; use App\Notifications\Oasis\ReminderForPaymentRequiredNotification;
use App\Services\StripeService;
use Carbon\Carbon;
class OasisService class OasisService
{ {
@@ -20,19 +17,18 @@ class OasisService
SubscriptionRequest::whereStatus('requested') SubscriptionRequest::whereStatus('requested')
->get() ->get()
->each(function ($request) { ->each(function ($request) {
// Get diffInHours // Get diffInHours
$diff = Carbon::parse($request->created_at) $diff = Carbon::parse($request->created_at)
->diffInHours(Carbon::now()); ->diffInHours(Carbon::now());
// Send order reminder // Send order reminder
if ($diff == 8) { if ($diff == 8) {
$plan = resolve(StripeService::class) $plan = resolve(StripeService::class)
->getPlan($request->requested_plan); ->getPlan($request->requested_plan);
$request->user->notify(new ReminderForPaymentRequiredNotification( $request->user->notify(new ReminderForPaymentRequiredNotification(
$request, $plan $request,
$plan
)); ));
} }
}); });
-1
View File
@@ -13,7 +13,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class StripeService class StripeService
{ {
/** /**
* Stripe Service constructor. * Stripe Service constructor.
*/ */
-1
View File
@@ -1,5 +1,4 @@
<?php <?php
namespace App\Traits; namespace App\Traits;
use App\Models\Oasis\Client; use App\Models\Oasis\Client;
+32 -32
View File
@@ -7,39 +7,39 @@
*/ */
return [ return [
'custom' => 'translation', 'custom' => 'translation',
// On boarding // On boarding
'successful_payment_with_password_creation' => 'Dakujeme, platba bola uspesne zaznamenana. V poslednom kroku si prosim vytvorte heslo pre Vas ucet.', 'successful_payment_with_password_creation' => 'Dakujeme, platba bola uspesne zaznamenana. V poslednom kroku si prosim vytvorte heslo pre Vas ucet.',
'pay_order_description' => 'Zaplacenim objednavky se Vas ucet automaticky zaktivuje a vytvori se Vam digitalni prostor pro Vase dulezite dokumenty.', 'pay_order_description' => 'Zaplacenim objednavky se Vas ucet automaticky zaktivuje a vytvori se Vam digitalni prostor pro Vase dulezite dokumenty.',
'payment_page.payment_gateway' => 'Platebni karta', 'payment_page.payment_gateway' => 'Platebni karta',
'payment_page.company' => 'Spolecnost', 'payment_page.company' => 'Spolecnost',
'payment_page.ico' => 'ICO', 'payment_page.ico' => 'ICO',
'payment_page.address' => 'Adresa', 'payment_page.address' => 'Adresa',
// Mail notifications for ordering // Mail notifications for ordering
'mail_greeting' => 'Vážený zákazníku,', 'mail_greeting' => 'Vážený zákazníku,',
'mail_salutation' => 'S pozdravem a přáním hezkého dne, Tým Oasis Drive', 'mail_salutation' => 'S pozdravem a přáním hezkého dne, Tým Oasis Drive',
'mail_tariff' => 'Vámi vybraný tarif: :name - :storage za :price', 'mail_tariff' => 'Vámi vybraný tarif: :name - :storage za :price',
'mail_activation_action' => 'Pro aktivaci klikněte zde', 'mail_activation_action' => 'Pro aktivaci klikněte zde',
'mail_order_subject' => '🏝 Potvrzeni Objednavky - OasisDrive', 'mail_order_subject' => '🏝 Potvrzeni Objednavky - OasisDrive',
'mail_order_line_1' => 'Právě jste si úspěšně vytvořil registraci bezpečnostní datové služby OasisDrive.', 'mail_order_line_1' => 'Právě jste si úspěšně vytvořil registraci bezpečnostní datové služby OasisDrive.',
'mail_order_line_2' => 'Odkaz je platný 24 hodin.', 'mail_order_line_2' => 'Odkaz je platný 24 hodin.',
'mail_order_line_3' => 'Po dokončení registrace v odkazu Vám bude služba automaticky aktivována a lze ji ihned využívat.', 'mail_order_line_3' => 'Po dokončení registrace v odkazu Vám bude služba automaticky aktivována a lze ji ihned využívat.',
'mail_reminder_line_1' => 'Děkujeme za Vaši objednávku služby Oasis Drive pro bezpečné uložení Vašich firemních dokumentů.', 'mail_reminder_line_1' => 'Děkujeme za Vaši objednávku služby Oasis Drive pro bezpečné uložení Vašich firemních dokumentů.',
'mail_reminder_line_2' => 'Připomínáme dokončení aktivace služby a blížící se konec platnosti registračního odkazu:', 'mail_reminder_line_2' => 'Připomínáme dokončení aktivace služby a blížící se konec platnosti registračního odkazu:',
'mail_reminder_line_3' => 'Po dokončení registrace v odkazu Vám bude služba automaticky aktivována a lze ji ihned využívat.', 'mail_reminder_line_3' => 'Po dokončení registrace v odkazu Vám bude služba automaticky aktivována a lze ji ihned využívat.',
// Admin // Admin
'oasis.create_order' => 'Vytvorit objednavku', 'oasis.create_order' => 'Vytvorit objednavku',
'oasis.create_user' => 'Vytvorit Uzivatela', 'oasis.create_user' => 'Vytvorit Uzivatela',
// Homepage // Homepage
'navigation.price' => 'Ceník', 'navigation.price' => 'Ceník',
'navigation.about-us' => 'O Nás', 'navigation.about-us' => 'O Nás',
'navigation.contact-and-support' => 'Kontakt a Podpora', 'navigation.contact-and-support' => 'Kontakt a Podpora',
'try_drive' => 'Vyzkouset OasisDrive', 'try_drive' => 'Vyzkouset OasisDrive',
@@ -48,25 +48,25 @@ return [
'contact.ico' => 'ICO', 'contact.ico' => 'ICO',
'contact.hq' => 'Sídlo', 'contact.hq' => 'Sídlo',
'homepage_header_title' => 'Jednoduchý a Bezpečný Cloud vo Vrecku', 'homepage_header_title' => 'Jednoduchý a Bezpečný Cloud vo Vrecku',
'homepage_header_description' => 'Virtuální šanon, vždy s tebou.', 'homepage_header_description' => 'Virtuální šanon, vždy s tebou.',
'homepage_feature_title' => 'Proč je OasisDrive Výnimočný?', 'homepage_feature_title' => 'Proč je OasisDrive Výnimočný?',
'homepage_feature_description' => 'Cloudové uložiště je v podstatě virtuální šanon, kam uživatelé ukládají svá data, ke kterým se mohou přihlásit odkudkoli v nezávislosti na zařízení. OasisDrive umožňuje bezpečně chránit Vaše firemní data.', 'homepage_feature_description' => 'Cloudové uložiště je v podstatě virtuální šanon, kam uživatelé ukládají svá data, ke kterým se mohou přihlásit odkudkoli v nezávislosti na zařízení. OasisDrive umožňuje bezpečně chránit Vaše firemní data.',
'feature_1_title' => 'Bezpecnost na prvnim miste', 'feature_1_title' => 'Bezpecnost na prvnim miste',
'feature_1_description' => 'Naše cloudové uložiště umožňuje bezpečně chránit Vaše firemní data. kdy využíváme několik vysoce zabezpečených serverů po Evropské unii a vícenásobným šifrováním souborů (tzv. kryptováním).', 'feature_1_description' => 'Naše cloudové uložiště umožňuje bezpečně chránit Vaše firemní data. kdy využíváme několik vysoce zabezpečených serverů po Evropské unii a vícenásobným šifrováním souborů (tzv. kryptováním).',
'feature_2_title' => 'Bezpečnost v rámci GDPR', 'feature_2_title' => 'Bezpečnost v rámci GDPR',
'feature_2_description' => 'bezpečnost uložení dat v rámci evropské směrnice o GDPR a přidružených zákonů o zpracování a ochraně citlivých údajů. Naši klienti jsou tedy chráněni před zneužitím dat a tím pádem i před pokutami vyplývajícími z legislativy, které být astronomické.', 'feature_2_description' => 'bezpečnost uložení dat v rámci evropské směrnice o GDPR a přidružených zákonů o zpracování a ochraně citlivých údajů. Naši klienti jsou tedy chráněni před zneužitím dat a tím pádem i před pokutami vyplývajícími z legislativy, které být astronomické.',
'feature_3_title' => 'Jednoduchost pouzivani', 'feature_3_title' => 'Jednoduchost pouzivani',
'feature_3_description' => 'Naše cloudové uložiště umožňuje bezpečně chránit Vaše firemní data. kdy využíváme několik vysoce zabezpečených serverů po Evropské unii a vícenásobným šifrováním souborů (tzv. kryptováním).', 'feature_3_description' => 'Naše cloudové uložiště umožňuje bezpečně chránit Vaše firemní data. kdy využíváme několik vysoce zabezpečených serverů po Evropské unii a vícenásobným šifrováním souborů (tzv. kryptováním).',
'homepage_pricing_title' => 'Kolik stoji OasisDrive?', 'homepage_pricing_title' => 'Kolik stoji OasisDrive?',
'homepage_pricing_description' => 'OasisDrive je dostupny v troch variantach. Ak presiahnete limit svojho balicka, mozete si navysit balik dat jednoduchym upgradom uctu.', 'homepage_pricing_description' => 'OasisDrive je dostupny v troch variantach. Ak presiahnete limit svojho balicka, mozete si navysit balik dat jednoduchym upgradom uctu.',
'homepage_about_us_title' => 'Kto Jsme?', 'homepage_about_us_title' => 'Kto Jsme?',
'homepage_about_us_description' => 'Jsme česká společnost, která pro fyzické a právnické osoby (živnostníky a firmy) poskytuje cloudové uložiště dle evropské směrnice (GDPR) a následného zákona o zpracování osobních údajů (zákon 110/2019 sb.).', 'homepage_about_us_description' => 'Jsme česká společnost, která pro fyzické a právnické osoby (živnostníky a firmy) poskytuje cloudové uložiště dle evropské směrnice (GDPR) a následného zákona o zpracování osobních údajů (zákon 110/2019 sb.).',
'homepage_about_us_line_1' => 'Zakládáme si na kvalitě a nejlepší možné bezpečnosti pro uchovávání a zpracování dat a dokumentů.', 'homepage_about_us_line_1' => 'Zakládáme si na kvalitě a nejlepší možné bezpečnosti pro uchovávání a zpracování dat a dokumentů.',
@@ -74,14 +74,14 @@ return [
'homepage_about_us_line_3' => 'Důležitá je pro nás uživatelská jednoduchost, stoprocentní funkčnost a přehlednost.', 'homepage_about_us_line_3' => 'Důležitá je pro nás uživatelská jednoduchost, stoprocentní funkčnost a přehlednost.',
'homepage_about_us_line_4' => 'Bezpečnost uložení dat tak, jak nařizuje směrnice EU (GDPR) a zákon o zpracování osobních údajů.', 'homepage_about_us_line_4' => 'Bezpečnost uložení dat tak, jak nařizuje směrnice EU (GDPR) a zákon o zpracování osobních údajů.',
'homepage_contact_title' => 'Kontakt a Podpora', 'homepage_contact_title' => 'Kontakt a Podpora',
'homepage_contact_description' => 'V pripade akychkolvek otazok nas nevahajte kontaktovat emailom, alebo na ktoromkolvek telefonnom cisle.', 'homepage_contact_description' => 'V pripade akychkolvek otazok nas nevahajte kontaktovat emailom, alebo na ktoromkolvek telefonnom cisle.',
'contact_company_title' => 'Společnost', 'contact_company_title' => 'Společnost',
'contact_support_title' => 'Podpora', 'contact_support_title' => 'Podpora',
'contact_sales_title' => 'Prodej', 'contact_sales_title' => 'Prodej',
'contact_documents_title' => 'Dokumenty', 'contact_documents_title' => 'Dokumenty',
'contact_leave_message_title' => 'Zanechte nám vzkaz', 'contact_leave_message_title' => 'Zanechte nám vzkaz',
'document_gdpr_policy' => 'Směrnice EU (GDPR)' 'document_gdpr_policy' => 'Směrnice EU (GDPR)',
]; ];
+5 -6
View File
@@ -1,7 +1,6 @@
<?php <?php
return [ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Snappy PDF / Image Configuration | Snappy PDF / Image Configuration
@@ -35,20 +34,20 @@ return [
'pdf' => [ 'pdf' => [
'enabled' => true, 'enabled' => true,
'binary' => env('WKHTML_PDF_BINARY', '/usr/local/bin/wkhtmltopdf'), 'binary' => env('WKHTML_PDF_BINARY', '/usr/local/bin/wkhtmltopdf'),
'timeout' => false, 'timeout' => false,
'options' => [ 'options' => [
'enable-local-file-access' => true, 'enable-local-file-access' => true,
'encoding' => 'UTF-8' 'encoding' => 'UTF-8',
], ],
'env' => [], 'env' => [],
], ],
'image' => [ 'image' => [
'enabled' => true, 'enabled' => true,
'binary' => env('WKHTML_IMG_BINARY', '/usr/local/bin/wkhtmltoimage'), 'binary' => env('WKHTML_IMG_BINARY', '/usr/local/bin/wkhtmltoimage'),
'timeout' => false, 'timeout' => false,
'options' => [], 'options' => [],
'env' => [], 'env' => [],
], ],
]; ];
+2 -3
View File
@@ -1,14 +1,13 @@
<?php <?php
use App\Services\Oasis\OasisDevService;
use App\Http\Controllers\Oasis\AdminController; use App\Http\Controllers\Oasis\AdminController;
use App\Http\Controllers\Oasis\ClientController; use App\Http\Controllers\Oasis\ClientController;
use App\Http\Controllers\Oasis\InvoiceController; use App\Http\Controllers\Oasis\InvoiceController;
use App\Http\Controllers\Oasis\InvoiceProfileController;
use App\Http\Controllers\Oasis\SubscriptionController; use App\Http\Controllers\Oasis\SubscriptionController;
use App\Services\Oasis\OasisDevService; use App\Http\Controllers\Oasis\InvoiceProfileController;
Route::group(['middleware' => 'api', 'prefix' => '/api/oasis'], function () { Route::group(['middleware' => 'api', 'prefix' => '/api/oasis'], function () {
// Admin // Admin
Route::group(['middleware' => 'auth:sanctum', 'prefix' => 'admin'], function () { Route::group(['middleware' => 'auth:sanctum', 'prefix' => 'admin'], function () {
Route::get('/company-details', [AdminController::class, 'get_company_details']); Route::get('/company-details', [AdminController::class, 'get_company_details']);