added invoice profile

This commit is contained in:
Peter Papp
2021-04-27 10:16:31 +02:00
parent f7135c9b27
commit e7c4048258
11 changed files with 232 additions and 145 deletions
+2 -20
View File
@@ -3,9 +3,6 @@
namespace Database\Factories\Oasis;
use App\Models\Oasis\Invoice;
use App\Models\User;
use Carbon\Carbon;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Factories\Factory;
class InvoiceFactory extends Factory
@@ -32,7 +29,7 @@ class InvoiceFactory extends Factory
'invoice_number' => $this->faker->numberBetween(2120001, 2120999),
'variable_number' => $this->faker->numberBetween(2120001, 2120999),
'currency' => $this->faker->randomElement(['CZK', 'EUR']),
'author_name' => $this->faker->name,
'user' => null,
'client' => [
'name' => $this->faker->company,
'email' => $this->faker->email,
@@ -47,21 +44,6 @@ class InvoiceFactory extends Factory
'dic' => $this->faker->numberBetween(11111111, 99999999),
'ic_dph' => 'CZ' . $this->faker->numberBetween(1111111111, 9999999999),
],
'user' => [
'name' => $this->faker->name,
'address' => $this->faker->address,
'state' => $this->faker->state,
'city' => $this->faker->city,
'postal_code' => $this->faker->postcode,
'country' => $this->faker->randomElement(
['SK', 'CZ', 'DE', 'FR']
),
'phone_number' => $this->faker->phoneNumber,
'bank_name' => $this->faker->randomElement(['Fio Banka', 'Tatra Banka']),
'iban' => $this->faker->iban('CZ'),
'swift' => $this->faker->swiftBicNumber,
],
'items' => [
[
'description' => $this->faker->realText(60),
@@ -77,7 +59,7 @@ class InvoiceFactory extends Factory
],
],
'discount_type' => $this->faker->randomElement(['percent', 'value', null]),
'delivery_at' => $this->faker->dateTimeBetween(
'delivery_at' => $this->faker->dateTimeBetween(
$startDate = '-6 months', $endDate = 'now', $timezone = null
),
'created_at' => $this->faker->dateTimeBetween(
@@ -0,0 +1,51 @@
<?php
namespace Database\Factories\Oasis;
use App\Models\Oasis\InvoiceProfile;
use Illuminate\Database\Eloquent\Factories\Factory;
class InvoiceProfileFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = InvoiceProfile::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'id' => $this->faker->uuid,
'user_id' => $this->faker->uuid,
'company' => $this->faker->company,
'logo' => '',
'email' => $this->faker->email,
'ico' => rand(11111111, 99999999),
'dic' => rand(11111111, 99999999),
'ic_dph' => 'SK' . rand(111111111111, 999999999999),
'registration_notes' => $this->faker->realText(80),
'author' => $this->faker->name,
'stamp' => '',
'address' => $this->faker->address,
'state' => $this->faker->state,
'city' => $this->faker->city,
'postal_code' => $this->faker->postcode,
'country' => $this->faker->randomElement([
'SK', 'CZ', 'DE', 'FR'
]),
'phone' => $this->faker->phoneNumber,
'bank' => $this->faker->randomElement([
'Fio Banka', 'Tatra Banka'
]),
'iban' => $this->faker->iban('CZ'),
'swift' => $this->faker->swiftBicNumber,
];
}
}
@@ -18,7 +18,9 @@ class CreateInvoicesTable extends Migration
$table->uuid('user_id')->index();
$table->uuid('client_id')->nullable()->index();
$table->enum('invoice_type', ['regular-invoice', 'advance-invoice']);
$table->enum('invoice_type', [
'regular-invoice', 'advance-invoice'
]);
$table->text('invoice_number')->nullable();
$table->text('variable_number')->nullable();
@@ -39,9 +41,6 @@ class CreateInvoicesTable extends Migration
$table->string('total_net')->nullable();
$table->string('total_tax')->nullable();
$table->text('author_stamp')->nullable();
$table->text('author_name')->nullable();
$table->timestamps();
});
}
@@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddBankDetailsToUserSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->text('registration_notes')->nullable();
$table->text('dic')->nullable();
$table->text('ic_dph')->nullable();
$table->text('bank_name')->nullable();
$table->text('iban')->nullable();
$table->text('swift')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_settings', function (Blueprint $table) {
$table->dropColumn(['bank_name','iban','swift']);
});
}
}
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInvoiceProfilesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoice_profiles', function (Blueprint $table) {
$table->uuid('id')->primary()->index();
$table->uuid('user_id')->index();
$table->text('company')->nullable();
$table->string('logo')->nullable();
$table->string('email')->nullable();
$table->string('phone')->nullable();
$table->text('address')->nullable();
$table->text('state')->nullable();
$table->text('city')->nullable();
$table->text('postal_code')->nullable();
$table->text('country')->nullable();
$table->string('ico')->nullable();
$table->string('dic')->nullable();
$table->string('ic_dph')->nullable();
$table->text('registration_notes')->nullable();
$table->text('bank')->nullable();
$table->string('iban')->nullable();
$table->string('swift')->nullable();
$table->string('author')->nullable();
$table->string('stamp')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('invoice_profiles');
}
}