text
stringlengths
9
39.2M
dir
stringlengths
26
295
lang
stringclasses
185 values
created_date
timestamp[us]
updated_date
timestamp[us]
repo_name
stringlengths
1
97
repo_full_name
stringlengths
7
106
star
int64
1k
183k
len_tokens
int64
1
13.8M
```php <?php use App\Models\Account; use App\Models\Currency; use App\Models\DateFormat; use App\Models\DateTimeFormat; use App\Models\Timezone; use Carbon\Carbon; use Faker\Generator; use Illuminate\Support\Str; $factory->define(Account::class, function (Generator $faker) { return [ 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'timezone_id' => function () { return factory(Timezone::class)->create()->id; }, 'date_format_id' => function () { return factory(DateFormat::class)->create()->id; }, 'datetime_format_id' => function () { return factory(DateTimeFormat::class)->create()->id; }, 'currency_id' => function () { return factory(Currency::class)->create()->id; }, 'name' => $faker->name, 'last_ip' => "127.0.0.1", 'last_login_date' => Carbon::now()->subDays(2), 'address1' => $faker->address, 'address2' => "", 'city' => $faker->city, 'state' => $faker->stateAbbr, 'postal_code' => $faker->postcode, // 'country_id' => factory(App\Models\Country::class)->create()->id, 'email_footer' => 'Email footer text', 'is_active' => false, 'is_banned' => false, 'is_beta' => false, 'stripe_access_token' => Str::random(10), 'stripe_refresh_token' => Str::random(10), 'stripe_secret_key' => Str::random(10), 'stripe_publishable_key' => Str::random(10), ]; }); ```
/content/code_sandbox/database/factories/Account.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
399
```php <?php $factory->define(App\Models\DateTimeFormat::class, function (Faker\Generator $faker) { return [ 'format' => "Y-m-d H:i:s", 'picker_format' => "Y-m-d H:i:s", 'label' => "utc", ]; }); ```
/content/code_sandbox/database/factories/DateTimeFormat.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
67
```php <?php use Carbon\Carbon; $factory->define(App\Models\Event::class, function (Faker\Generator $faker) { return [ 'title' => $faker->name, 'location' => $faker->text, 'bg_type' => 'color', 'bg_color' => config('attendize.event_default_bg_color'), 'bg_image_path' => $faker->imageUrl, 'description' => $faker->text, 'start_date' => Carbon::now()->format(config('attendize.default_datetime_format')), 'end_date' => Carbon::now()->addWeek()->format(config('attendize.default_datetime_format')), 'on_sale_date' => Carbon::now()->subDays(20)->format(config('attendize.default_datetime_format')), 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'user_id' => function () { return factory(App\Models\User::class)->create()->id; }, 'currency_id' => function () { return factory(App\Models\Currency::class)->create()->id; }, 'organiser_fee_fixed' => 0.00, 'organiser_fee_percentage' => 0.00, 'organiser_id' => function () { return factory(App\Models\Organiser::class)->create()->id; }, 'venue_name' => $faker->name, 'venue_name_full' => $faker->name, 'location_address' => $faker->address, 'location_address_line_1' => $faker->streetAddress, 'location_address_line_2' => $faker->secondaryAddress, 'location_country' => $faker->country, 'location_country_code' => $faker->countryCode, 'location_state' => $faker->state, 'location_post_code' => $faker->postcode, 'location_street_number' => $faker->buildingNumber, 'location_lat' => $faker->latitude, 'location_long' => $faker->longitude, 'location_google_place_id' => $faker->randomDigit, 'pre_order_display_message' => $faker->text, 'post_order_display_message' => $faker->text, 'social_share_text' => 'Check Out [event_title] - [event_url]', 'social_show_facebook' => true, 'social_show_linkedin' => true, 'social_show_twitter' => true, 'social_show_email' => true, 'location_is_manual' => 0, 'is_live' => false, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'deleted_at' => null, ]; }); ```
/content/code_sandbox/database/factories/Event.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
581
```php <?php use Illuminate\Support\Carbon; $factory->define(App\Models\EventAccessCodes::class, function (Faker\Generator $faker) { return [ 'event_id' => function () { return factory(App\Models\Event::class)->create()->id; }, 'code' => $faker->word, 'usage_count' => 0, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'deleted_at' => null, ]; }); ```
/content/code_sandbox/database/factories/EventAccessCodes.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
108
```php <?php $factory->define(App\Models\Organiser::class, function (Faker\Generator $faker) { return [ 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'name' => $faker->name, 'about' => $faker->text, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'facebook' => 'path_to_url 'twitter' => 'path_to_url 'logo_path' => 'path/to/logo', 'is_email_confirmed' => 0, 'confirmation_key' => Str::Random(15), 'show_twitter_widget' => $faker->boolean, 'show_facebook_widget' => $faker->boolean, 'page_header_bg_color' => $faker->hexcolor, 'page_bg_color' => '#ffffff', 'page_text_color' => '#000000', 'enable_organiser_page' => $faker->boolean, 'google_analytics_code' => null, 'tax_name' => $faker->text(11) . ' tax', 'tax_value' => $faker->randomFloat(2, 0, 30), 'tax_id' => '', 'charge_tax' => $faker->boolean ]; }); ```
/content/code_sandbox/database/factories/Organiser.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
289
```php <?php use Illuminate\Support\Carbon; $factory->define(App\Models\Ticket::class, function (Faker\Generator $faker) { return [ 'user_id' => function () { return factory(App\Models\User::class)->create()->id; }, 'edited_by_user_id' => function () { return factory(App\Models\User::class)->create()->id; }, 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'order_id' => function () { return factory(App\Models\Order::class)->create()->id; }, 'event_id' => function () { return factory(App\Models\Event::class)->create()->id; }, 'title' => $faker->name, 'description' => $faker->text, 'price' => 50.00, 'max_per_person' => 4, 'min_per_person' => 1, 'quantity_available' => 50, 'quantity_sold' => 0, 'start_sale_date' => Carbon::now()->format(config('attendize.default_datetime_format')), 'end_sale_date' => Carbon::now()->addDays(20)->format(config('attendize.default_datetime_format')), 'sales_volume' => 0, 'organiser_fees_volume' => 0, 'is_paused' => 0, 'public_id' => null, 'sort_order' => 0, 'is_hidden' => false, ]; }); ```
/content/code_sandbox/database/factories/Ticket.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
328
```php <?php use App\Models\Timezone; $factory->define(Timezone::class, function (Faker\Generator $faker) { return [ 'name' => $faker->timezone, 'location' => $faker->city, ]; }); $factory->state(Timezone::class, 'Europe/London', [ 'name' => 'Europe/London', 'location' => '(GMT) London', ]); ```
/content/code_sandbox/database/factories/Timezone.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
92
```php <?php $factory->define(App\Models\OrderItem::class, function (Faker\Generator $faker) { return [ 'title' => $faker->title, 'quantity' => 5, 'unit_price' => 20.00, 'unit_booking_fee' => 2.00, 'order_id' => function () { return factory(App\Models\Order::class)->create()->id; } ]; }); ```
/content/code_sandbox/database/factories/OrderItem.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
96
```php <?php use Illuminate\Support\Carbon; $factory->define(App\Models\EventStats::class, function (Faker\Generator $faker) { return [ 'date' => Carbon::now(), 'views' => 0, 'unique_views' => 0, 'tickets_sold' => 0, 'sales_volume' => 0, 'organiser_fees_volume' => 0, 'event_id' => function () { return factory(App\Models\Event::class)->create()->id; }, ]; }); ```
/content/code_sandbox/database/factories/EventStats.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
116
```php <?php use Illuminate\Support\Carbon; $factory->define(App\Models\Order::class, function (Faker\Generator $faker) { return [ 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'order_status_id' => function () { return factory(App\Models\OrderStatus::class)->create()->id; }, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'ticket_pdf_path' => '/ticket/pdf/path', 'order_reference' => $faker->text(15), 'transaction_id' => $faker->text(50), 'discount' => .20, 'booking_fee' => .10, 'organiser_booking_fee' => .10, 'order_date' => Carbon::now(), 'notes' => $faker->text, 'is_deleted' => 0, 'is_cancelled' => 0, 'is_partially_refunded' => 0, 'is_refunded' => 0, 'amount' => 20.00, 'amount_refunded' => 0, 'event_id' => function () { return factory(App\Models\Event::class)->create()->id; }, 'payment_gateway_id' => 1, 'is_payment_received' => false, 'taxamt' => 0 ]; }); ```
/content/code_sandbox/database/factories/Order.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
317
```php <?php $factory->define(App\Models\User::class, function (Faker\Generator $faker) { return [ 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'phone' => $faker->phoneNumber, 'email' => $faker->email, 'password' => $faker->password, 'confirmation_code' => $faker->randomNumber, 'is_registered' => false, 'is_confirmed' => false, 'is_parent' => false, 'remember_token' => $faker->randomNumber ]; }); ```
/content/code_sandbox/database/factories/User.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
156
```php <?php use App\Models\OrderStatus; $factory->define(OrderStatus::class, function (Faker\Generator $faker) { $selection = ['Completed', 'Refunded', 'Partially Refunded', 'Cancelled']; return [ 'name' => $faker->randomElement($selection), ]; }); ```
/content/code_sandbox/database/factories/OrderStatus.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
68
```php <?php use App\Models\Currency; $factory->define(Currency::class, function (Faker\Generator $faker) { return [ 'title' => "Dollar", 'symbol_left' => "$", 'symbol_right' => "", 'code' => 'USD', 'decimal_place' => 2, 'value' => 100.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, ]; }); $factory->state(Currency::class, 'GBP', [ 'title' => 'Pound Sterling', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'GBP', 'decimal_place' => 2, 'value' => 0.62220001, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, ]); ```
/content/code_sandbox/database/factories/Currency.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
203
```php <?php use App\Models\AccountPaymentGateway; $factory->define(AccountPaymentGateway::class, function (Faker\Generator $faker) { return [ 'account_id' => function () { return factory(App\Models\Account::class)->create()->id; }, 'payment_gateway_id' => function () { return factory(App\Models\PaymentGateway::class)->create()->id; }, 'config' => [ 'apiKey' => '', 'publishableKey' => '', ], ]; }); ```
/content/code_sandbox/database/factories/AccountPaymentGateway.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
112
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddAmountsFieldToEventAccessCodes extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('event_access_codes', function (Blueprint $table) { $table->unsignedInteger('usage_count')->default(0)->after('code'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('event_access_codes', function (Blueprint $table) { $table->dropColumn('usage_count'); }); } } ```
/content/code_sandbox/database/migrations/2019_02_13_130258_add_amounts_field_to_event_access_codes.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
154
```php <?php use App\Models\TicketStatus; $factory->define(TicketStatus::class, function (Faker\Generator $faker) { $selection = ['Sold Out', 'Sales Have Ended', 'Not On Sale Yet', 'On Sale']; return [ 'name' => $faker->randomElement($selection), ]; }); ```
/content/code_sandbox/database/factories/TicketStatus.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
73
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use App\Models\Attendee; use App\Models\Order; class AttendeeRefFix extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('attendees', function (Blueprint $table) { $table->integer('reference_index')->default(0); }); $attendees = Attendee::all(); foreach($attendees as $attendee) { $attendee->reference_index = explode('-', $attendee->reference)[1]; $attendee->save(); } Schema::table('attendees', function (Blueprint $table) { $table->dropColumn('reference'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('attendees', function (Blueprint $table) { $table->string('reference'); $table->dropColumn('reference_index'); }); $orders = Order::all(); foreach ($orders as $order) { $attendee_count = 0; foreach($order->attendees as $attendee) { $attendee->reference = $order->order_reference. '-' . ++$attendee_count; $attendee->save(); } } } } ```
/content/code_sandbox/database/migrations/2016_05_25_145857_attendee_ref_fix.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
301
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class RemoveAskForInEvents extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('ask_for_all_attendees_info'); }); } public function down() { } } ```
/content/code_sandbox/database/migrations/2016_05_22_041458_remove_ask_for_in_events.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
95
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddIsHiddenTicketsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('tickets', function (Blueprint $table) { $table->boolean('is_hidden')->default(0); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('tickets', function (Blueprint $table) { $table->dropColumn('is_hidden'); }); } } ```
/content/code_sandbox/database/migrations/2016_10_22_150532_add_is_hidden_tickets_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
136
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class Add1dBarcodeOptionToEventsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->boolean('is_1d_barcode_enabled')->default(0); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('is_1d_barcode_enabled'); }); } } ```
/content/code_sandbox/database/migrations/2016_07_07_143106_add_1d_barcode_option_to_events_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
149
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddTicketDesignOptions extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { /* * @see path_to_url */ $table->string('barcode_type', 20)->default('QRCODE'); $table->string('ticket_border_color', 20)->default('#000000'); $table->string('ticket_bg_color', 20)->default('#FFFFFF'); $table->string('ticket_text_color', 20)->default('#000000'); $table->string('ticket_sub_text_color', 20)->default('#999999'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn([ 'barcode_type', 'ticket_border_color', 'ticket_bg_color', 'ticket_text_color', 'ticket_sub_text_color' ]); }); } } ```
/content/code_sandbox/database/migrations/2016_03_09_221103_add_ticket_design_options.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
253
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreatePasswordResetsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); $table->string('token')->index(); $table->timestamp('created_at')->useCurrent(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('password_resets'); } } ```
/content/code_sandbox/database/migrations/2014_10_12_100000_create_password_resets_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
140
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use App\Models\PaymentGateway; class DropCoinbaseAndMigsAsDefaults extends Migration { /** * Run the migrations. * * @return void */ public function up() { PaymentGateway::where('name', 'Coinbase')->delete(); PaymentGateway::where('name', 'Migs_ThreeParty')->delete(); } /** * Reverse the migrations. * * @return void */ public function down() { // } } ```
/content/code_sandbox/database/migrations/2018_08_16_131955_drop_coinbase_and_migs_as_defaults.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
130
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddBusinessFieldsToOrder extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('orders', function (Blueprint $table) { $table->boolean('is_business')->default(false)->after('is_payment_received'); $table->string('business_name')->after('email')->nullable(); $table->string('business_tax_number')->after('business_name')->nullable(); $table->string('business_address_line_one')->after('business_tax_number')->nullable(); $table->string('business_address_line_two')->after('business_address_line_one')->nullable(); $table->string('business_address_state_province')->after('business_address_line_two')->nullable(); $table->string('business_address_city')->after('business_address_state_province')->nullable(); $table->string('business_address_code')->after('business_address_city')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('orders', function (Blueprint $table) { $table->dropColumn([ 'is_business', 'business_name', 'business_tax_number', 'business_address_line_one', 'business_address_line_two', 'business_address_state_province', 'business_address_city', 'business_address_code', ]); }); } } ```
/content/code_sandbox/database/migrations/2019_04_17_171440_add_business_fields_to_order.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
326
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddAccountPaymentId extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('orders', function (Blueprint $table) { $table->unsignedInteger('payment_gateway_id')->nullable(); $table->foreign('payment_gateway_id')->references('id')->on('payment_gateways'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('orders', function (Blueprint $table) { $table->dropForeign('orders_payment_gateway_id_foreign'); $table->dropColumn('payment_gateway_id'); }); } } ```
/content/code_sandbox/database/migrations/2016_03_16_213041_add_account_payment_id.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
169
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class OrganiserPageDesignUpdate extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->boolean('show_twitter_widget')->default(false); $table->boolean('show_facebook_widget')->default(false); $table->string('page_header_bg_color', 20)->default('#76a867'); $table->string('page_bg_color', 20)->default('#EEEEEE'); $table->string('page_text_color', 20)->default('#FFFFFF'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->dropColumn('show_twitter_widget'); $table->dropColumn('show_facebook_widget'); $table->dropColumn('page_header_bg_color'); $table->dropColumn('page_bg_color'); $table->dropColumn('page_text_color'); }); } } ```
/content/code_sandbox/database/migrations/2016_03_25_114646_organiser_page_design_update.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
252
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateFailedJobsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('failed_jobs', function (Blueprint $table) { $table->increments('id'); $table->text('connection'); $table->text('queue'); $table->text('payload'); $table->timestamp('failed_at')->useCurrent(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('failed_jobs'); } } ```
/content/code_sandbox/database/migrations/2014_11_17_011806_create_failed_jobs_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
149
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class UpdateEventOrganiserPercentageFeesAllowableLength extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->decimal('organiser_fee_percentage', 5, 2)->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->decimal('organiser_fee_percentage', 4, 3)->change(); }); } } ```
/content/code_sandbox/database/migrations/2019_11_12_060447_update_event_organiser_percentage_fees_allowable_length.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
162
```php <?php use Illuminate\Database\Migrations\Migration; class UpdateTestPaymentGatewayRefund extends Migration { /** * Run the migrations. * * @return void */ public function up() { DB::table('payment_gateways') ->where('name', 'Stripe\PaymentIntents') ->update(['can_refund' => 1]); } /** * Reverse the migrations. * * @return void */ public function down() { // } } ```
/content/code_sandbox/database/migrations/2019_11_07_085418_update_test_payment_gateway_refund.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
112
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddQuestionAnswersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('question_answers', function (Blueprint $table) { $table->increments('id'); $table->integer('attendee_id')->unsigned()->index(); $table->integer('event_id')->unsigned()->index(); $table->integer('question_id')->unsigned()->index(); $table->integer('account_id')->unsigned()->index(); $table->text('answer_text'); $table->nullableTimestamps(); $table->foreign('question_id')->references('id')->on('questions'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $table->foreign('attendee_id')->references('id')->on('attendees')->onDelete('cascade'); $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Schema::drop('question_answers'); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } } ```
/content/code_sandbox/database/migrations/2016_04_03_221050_add_question_answers_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
291
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class DisableRefundsOnStripeSca extends Migration { /** * Run the migrations. * * @return void */ public function up() { DB::table('payment_gateways') ->where('name', 'Stripe\PaymentIntents') ->update(['can_refund' => 0]); } /** * Reverse the migrations. * * @return void */ public function down() { // } } ```
/content/code_sandbox/database/migrations/2019_09_18_082447_disable_refunds_on_stripe_sca.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
125
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddWhatsappShareOptionEvents extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->boolean('social_show_whatsapp')->default(1); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('social_show_whatsapp'); }); } } ```
/content/code_sandbox/database/migrations/2016_03_22_021114_add_whatsapp_share_option_events.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
141
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AdditionalTaxFieldRenameCurrentTaxFields extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->boolean('charge_tax')->default(0); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('taxname', 'tax_name'); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('taxvalue', 'tax_value'); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('taxid', 'tax_id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->dropColumn('charge_tax'); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('tax_name', 'taxname'); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('tax_value', 'taxvalue'); }); Schema::table('organisers', function (Blueprint $table) { $table->renameColumn('tax_id', 'taxid'); }); } } ```
/content/code_sandbox/database/migrations/2018_07_09_133243_additional_tax_field_rename_current_tax_fields.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
326
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddSupportForOfflinePayments extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('orders', function (Blueprint $table) { $table->boolean('is_payment_received')->default(0); }); Schema::table('events', function (Blueprint $table) { $table->boolean('enable_offline_payments')->default(0); $table->text('offline_payment_instructions')->nullable(); }); $order_statuses = [ [ 'id' => 5, 'name' => 'Awaiting Payment', ], ]; DB::table('order_statuses')->insert($order_statuses); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('orders', function (Blueprint $table) { $table->dropColumn('is_payment_received'); }); Schema::table('events', function (Blueprint $table) { $table->dropColumn('enable_offline_payments'); $table->dropColumn('offline_payment_instructions'); }); DB::table('order_statuses')->where('name', 'Awaiting Payment')->delete(); } } ```
/content/code_sandbox/database/migrations/2016_07_08_133056_add_support_for_offline_payments.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
282
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateTicketEventAccessCodeTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('ticket_event_access_code', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('ticket_id'); $table->unsignedInteger('event_access_code_id'); $table->timestamps(); $table->foreign('ticket_id')->references('id')->on('tickets'); $table->foreign('event_access_code_id')->references('id')->on('event_access_codes'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::disableForeignKeyConstraints(); Schema::dropIfExists('ticket_event_access_code'); Schema::enableForeignKeyConstraints(); } } ```
/content/code_sandbox/database/migrations/2019_01_14_185419_create_ticket_event_access_code_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
205
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddGoogleAnalyticsCodeToOrganiser extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->string('google_analytics_code')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->dropColumn('google_analytics_code'); }); } } ```
/content/code_sandbox/database/migrations/2016_09_16_221455_add_google_analytics_code_to_organiser.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
142
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddTaxidToOrganisers extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function($table) { $table->string('taxid', 100)->default(''); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function($table) { $table->dropColumn('taxid'); }); } } ```
/content/code_sandbox/database/migrations/2018_03_01_150711_add_taxid_to_organisers.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
136
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddGtmFieldToOrganiser extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->string('google_tag_manager_code', 20)->after('google_analytics_code') ->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->dropColumn('google_tag_manager_code'); }); } } ```
/content/code_sandbox/database/migrations/2019_05_14_122245_add_gtm_field_to_organiser.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
160
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateGatewaysTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('payment_gateways', function (Blueprint $table) { $table->increments('id'); $table->string('provider_name', 50); $table->string('provider_url'); $table->boolean('is_on_site'); $table->boolean('can_refund')->default(0); $table->string('name', 50); }); Schema::create('account_payment_gateways', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('account_id'); $table->unsignedInteger('payment_gateway_id'); $table->text('config'); $table->softDeletes(); $table->nullableTimestamps(); $table->foreign('payment_gateway_id')->references('id')->on('payment_gateways')->onDelete('cascade'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('account_payment_gateways'); Schema::drop('payment_gateways'); } } ```
/content/code_sandbox/database/migrations/2016_03_16_193757_create_gateways_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
297
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class UpdateEventsTableSetNullableFields extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', static function (Blueprint $table) { $table->string('location_address_line_1', 355)->nullable()->change(); $table->string('location_address_line_2', 355)->nullable()->change(); $table->string('location_state', 355)->nullable()->change(); $table->string('location_post_code', 355)->nullable()->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', static function (Blueprint $table) { $table->string('location_address_line_1', 355)->nullable(false)->default('')->change(); $table->string('location_address_line_2', 355)->nullable(false)->default('')->change(); $table->string('location_state', 355)->nullable(false)->default('')->change(); $table->string('location_post_code', 355)->nullable(false)->default('')->change(); }); } } ```
/content/code_sandbox/database/migrations/2019_09_18_215710_update_events_table_set_nullable_fields.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
280
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddOrganiserPageToggle extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->boolean('enable_organiser_page')->default(1); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->dropColumn('enable_organiser_page'); }); } } ```
/content/code_sandbox/database/migrations/2016_03_27_223733_add_organiser_page_toggle.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
144
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddEventImagePositionToEvents extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->string('event_image_position')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('event_image_position'); }); } } ```
/content/code_sandbox/database/migrations/2018_12_04_034523_add_event_image_position_to_events.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
143
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddGatewayIdAccountsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('accounts', function (Blueprint $table) { $table->unsignedInteger('payment_gateway_id')->default(config('attendize.payment_gateway_stripe')); $table->foreign('payment_gateway_id')->references('id')->on('payment_gateways'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('accounts', function (Blueprint $table) { $table->dropForeign('accounts_payment_gateway_id_foreign'); $table->dropColumn('payment_gateway_id'); }); } } ```
/content/code_sandbox/database/migrations/2016_03_16_215709_add_gateway_id_accounts_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
178
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddApiKeyUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('users', function (Blueprint $table) { $table->string('api_token', 60)->unique()->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('users', function (Blueprint $table) { $table->dropColumn('api_token'); }); } } ```
/content/code_sandbox/database/migrations/2016_04_13_151256_add_api_key_users_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
138
```php <?php use Illuminate\Database\Migrations\Migration; class SetupCountriesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { // Creates the users table Schema::create('countries', function ($table) { $table->integer('id')->index(); $table->string('capital', 255)->nullable(); $table->string('citizenship', 255)->nullable(); $table->string('country_code', 3)->default(''); $table->string('currency', 255)->nullable(); $table->string('currency_code', 255)->nullable(); $table->string('currency_sub_unit', 255)->nullable(); $table->string('full_name', 255)->nullable(); $table->string('iso_3166_2', 2)->default(''); $table->string('iso_3166_3', 3)->default(''); $table->string('name', 255)->default(''); $table->string('region_code', 3)->default(''); $table->string('sub_region_code', 3)->default(''); $table->boolean('eea')->default(0); $table->primary('id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('countries'); } } ```
/content/code_sandbox/database/migrations/2014_04_08_232044_setup_countries_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
307
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddTaxToOrganizers extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function($table) { $table->string('taxname', 15)->default(''); $table->float('taxvalue')->default(0.00); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function($table) { $table->dropColumn('taxname'); $table->dropColumn('taxvalue'); }); } } ```
/content/code_sandbox/database/migrations/2018_02_26_172146_add_tax_to_organizers.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
160
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddTaxamtToOrdersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('orders', function($table) { $table->float('taxamt')->default(0.00); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('orders', function($table) { $table->dropColumn('taxamt'); }); } } ```
/content/code_sandbox/database/migrations/2018_02_27_175149_add_taxamt_to_orders_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
135
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddIsRefundedColumnToAttendees extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('attendees', function($t) { $t->boolean('is_refunded')->default(0); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('attendees', function($t) { $t->dropColumn('is_refunded'); }); } } ```
/content/code_sandbox/database/migrations/2016_06_14_115337_add_is_refunded_column_to_attendees.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
141
```php <?php use App\Models\EventStats; use App\Models\Order; use App\Models\Ticket; use App\Models\Event; use Carbon\Carbon; use Illuminate\Database\Migrations\Migration; use Superbalist\Money\Money; class RetrofitFixScriptForStats extends Migration { /** * Run the migrations. * * @return void */ public function up() { /* * Link tickets to their orders based on the order items on each order record. It will try and * find the ticket on the event and match the order item title to the ticket title. */ Order::all()->map(function($order) { $event = $order->event()->first(); $tickets = $event->tickets()->get(); $orderItems = $order->orderItems()->get(); // We would like a list of titles from the order items to test against existing tickets $mapOrderItemTitles = $orderItems->map(function($orderItem) { return $orderItem->title; }); // Filter tickets who's title is contained in the order items set $ticketsFound = $tickets->filter(function($ticket) use ($mapOrderItemTitles) { return ($mapOrderItemTitles->contains($ticket->title)); }); // Attach the ticket to it's order to keep referencial integrity $ticketsFound->map(function($ticket) use ($order) { $pivotExists = $order->tickets()->where('ticket_id', $ticket->id)->exists(); if (!$pivotExists) { \Log::debug(sprintf("Attaching Ticket (ID:%d) to Order (ID:%d)", $ticket->id, $order->id)); $order->tickets()->attach($ticket); } }); /* * Next we need to check if the order amount is the same as the total of the order items. * We use the order items as the source of truth for setting order amounts to the correct ones. */ $orderStringValue = $orderItems->reduce(function($carry, $orderItem) { $orderTotal = (new Money($carry)); $orderItemValue = (new Money($orderItem->unit_price))->multiply($orderItem->quantity); return $orderTotal->add($orderItemValue)->format(); }); // Refunded orders had their amounts wiped in previous versions so we need to fix that before we can work on stats $orderItemsValue = (new Money($orderStringValue)); $oldOrderAmount = (new Money($order->amount)); // We are checking to see if there is a change from what is stored vs what the order items says if ($oldOrderAmount->equals($orderItemsValue) === false) { \Log::debug(sprintf( "Setting Order (ID:%d, OLD_AMOUNT:%s) amount to match Order Items Amount: %s", $order->id, $oldOrderAmount->format(), $orderItemsValue->format() )); $order->amount = $orderItemsValue->toFloat(); $order->save(); } // If the order is cancelled but the linked attendees are not marked as cancelled and refunded, we need to fix that if ($order->is_refunded) { $order->attendees()->get()->map(function($attendee) { // Mark attendees as cancelled and refunded if the order is cancelled if (!$attendee->is_refunded) { \Log::debug(sprintf("Marking Attendee (ID:%d) as refunded",$attendee->id)); $attendee->is_refunded = true; } if (!$attendee->is_cancelled) { \Log::debug(sprintf("Marking Attendee (ID:%d) as cancelled",$attendee->id)); $attendee->is_cancelled = true; } // Update the attendee to reflect the real world $attendee->save(); }); } }); /** * Next we need to check if the sales volume on the ticket is correct based on the order items again * as the source of truth. We ignore tickets where the order is refunded. */ Ticket::all()->map(function($ticket) { // NOTE: We need to ignore refunded orders when calculating the ticket sales volume. /** @var Ticket $ticket */ $orders = $ticket->orders()->where('is_refunded', false)->get(); // Calculate the ticket sales value from the order items linked to a ticket. $ticketStringValue = $orders->reduce(function($ticketCarry, $order) use ($ticket) { $ticketTotal = (new Money($ticketCarry)); /** @var Order $order */ $orderItems = $order->orderItems()->get(); $orderStringValue = $orderItems->reduce(function($carry, $orderItem) use ($ticket) { $orderTotal = (new Money($carry)); $orderItemValue = (new Money($orderItem->unit_price))->multiply($orderItem->quantity); // Only count the order items related to the ticket if (trim($ticket->title) === trim($orderItem->title)) { return $orderTotal->add($orderItemValue)->format(); } return $orderTotal->format(); }); $orderValue = (new Money($orderStringValue)); return $ticketTotal->add($orderValue)->format(); }); // Compare the current value against the calculated one and update as needed $oldTicketSalesVolume = (new Money($ticket->sales_volume)); $orderItemsTicketSalesVolume = (new Money($ticketStringValue)); if ($oldTicketSalesVolume->equals($orderItemsTicketSalesVolume) === false) { \Log::debug(sprintf( "Updating Ticket (ID:%d, OLD_AMOUNT:%s) - New Sales Volume (%s)", $ticket->id, $oldTicketSalesVolume->format(), $orderItemsTicketSalesVolume->format() )); $ticket->sales_volume = $orderItemsTicketSalesVolume->toFloat(); $ticket->save(); } /** * Do the same check for ticket quantity sold against the order items. Lucky for us the order item * saved the quantity of tickets sold. */ $ticketQuantity = $orders->reduce(function ($ticketCarry, $order) use ($ticket) { $orderItems = $order->orderItems()->get(); $orderQuantity = $orderItems->reduce(function ($carry, $orderItem) use ($ticket) { if (trim($ticket->title) === trim($orderItem->title)) { return $carry + $orderItem->quantity; } return $carry; }); return $ticketCarry + $orderQuantity; }); // We need to update the ticket quantity if the order items reflect otherwise if ((int)$ticket->quantity_sold !== (int)$ticketQuantity) { \Log::debug(sprintf( "Updating Ticket (ID:%d, OLD_QUANTITY:%d) - New Quantity (%d)", $ticket->id, $ticket->quantity_sold, $ticketQuantity )); $ticket->quantity_sold = $ticketQuantity; $ticket->save(); } }); // We need to calculate the time based stats on events going back in time to fix any inconsistencies. Event::all()->map(function($event) { /** @var $event Event */ $orders = $event->orders()->where('is_refunded', false)->get(); /** * We will build the event stats for all orders in an event along with their create date as * the key for the dashboard graphs. We are ignoring views as it's out of scope for this fix. */ $orderTimeBasedStats = []; $orders->map(function($order) use (&$orderTimeBasedStats) { /** @var $order Order */ $orderItems = $order->orderItems()->get(); $quantity = $orderItems->reduce(function ($carry, $orderItem) { return $carry + $orderItem->quantity; }); $orderDay = Carbon::createFromTimeString($order->created_at)->format('Y-m-d'); if (!isset($orderTimeBasedStats[$orderDay])) { $orderTimeBasedStats[$orderDay] = [ 'quantity' => 0, 'sales_volume' => new Money(0), ]; } // Increment any hits on already saved days for quantity $orderTimeBasedStats[$orderDay]['quantity'] += $quantity; /** @var Money $previousSalesVolume */ $previousSalesVolume = $orderTimeBasedStats[$orderDay]['sales_volume']; // Increment any hits on already saved days for amounts $orderAmount = new Money($order->amount); $orderTimeBasedStats[$orderDay]['sales_volume'] = $previousSalesVolume->add($orderAmount); }); /** * Event stats needs to be checked so the dashboard time series graphs match the historical order amounts * and amount of tickets sold per day. */ EventStats::where('event_id', $event->id)->get()->map(function($eventStat) use ($orderTimeBasedStats) { /** @var $eventStat EventStats */ if (isset($orderTimeBasedStats[$eventStat->date])) { // Here we are comparing the calculated ticket quantity against the current one and updating if needed $timeBasedQuantity = $orderTimeBasedStats[$eventStat->date]['quantity']; if ($eventStat->tickets_sold !== $timeBasedQuantity) { \Log::debug(sprintf( "Updating Event Stat (ID:%d, OLD_QUANTITY:%d) - New Quantity %d", $eventStat->id, $eventStat->tickets_sold, $timeBasedQuantity )); $eventStat->tickets_sold = $timeBasedQuantity; } // Here we are comparing the calculated ticket amounts against the current one and updating if needed $oldEventStatsSalesVolume = new Money($eventStat->sales_volume); $timeBasedSalesVolume = $orderTimeBasedStats[$eventStat->date]['sales_volume']; if ($oldEventStatsSalesVolume->equals($timeBasedSalesVolume) === false) { \Log::debug(sprintf( "Updating Event Stat (ID:%d, OLD_SALES_VOLUME:%s) - New Sales Volume %s", $eventStat->id, $oldEventStatsSalesVolume->format(), $timeBasedSalesVolume->format() )); $eventStat->sales_volume = $timeBasedSalesVolume->toFloat(); } if ($eventStat->isDirty()) { // Persist event stat changes to reflect order amounts and tickets sold $eventStat->save(); } } else { /* * If the order stats does not exist, but the event stat has quantity and sales_volume then * we need to kill the values since there is no subsequent order information to back their * existence. Again this is built from the order items as the source of truth. */ if ($eventStat->tickets_sold > 0) { \Log::debug(sprintf( "Clearing Event Stat (ID:%d, TICKETS_SOLD:%d, SALES_VOLUME:%f) due to no order information", $eventStat->id, $eventStat->tickets_sold, $eventStat->sales_volume )); $eventStat->tickets_sold = 0; $eventStat->sales_volume = 0.0; $eventStat->save(); } } }); }); // This was rough I know but it was worth it. } /** * @return void */ public function down() { // Nothing to do here. This can run multiple times and will only attempt to fix the stats across events, // tickets and orders in the database. } } ```
/content/code_sandbox/database/migrations/2019_07_09_073928_retrofit_fix_script_for_stats.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
2,553
```php <?php use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('order_statuses', function ($t) { $t->increments('id'); $t->string('name'); }); Schema::create('ticket_statuses', function ($table) { $table->increments('id'); $table->text('name'); }); Schema::create('reserved_tickets', function ($table) { $table->increments('id'); $table->integer('ticket_id'); $table->integer('event_id'); $table->integer('quantity_reserved'); $table->datetime('expires'); $table->string('session_id', 45); $table->nullableTimestamps(); }); Schema::create('timezones', function ($t) { $t->increments('id'); $t->string('name'); $t->string('location'); }); Schema::create('date_formats', function ($t) { $t->increments('id'); $t->string('format'); $t->string('picker_format'); $t->string('label'); }); Schema::create('datetime_formats', function ($t) { $t->increments('id'); $t->string('format'); $t->string('picker_format'); $t->string('label'); }); // Create the `currency` table Schema::create('currencies', function ($table) { $table->increments('id')->unsigned(); $table->string('title', 255); $table->string('symbol_left', 12); $table->string('symbol_right', 12); $table->string('code', 3); $table->integer('decimal_place'); $table->double('value', 15, 8); $table->string('decimal_point', 3); $table->string('thousand_point', 3); $table->integer('status'); $table->nullableTimestamps(); }); /* * Accounts table */ Schema::create('accounts', function ($t) { $t->increments('id'); $t->string('first_name'); $t->string('last_name'); $t->string('email'); $t->unsignedInteger('timezone_id')->nullable(); $t->unsignedInteger('date_format_id')->nullable(); $t->unsignedInteger('datetime_format_id')->nullable(); $t->unsignedInteger('currency_id')->nullable(); //$t->unsignedInteger('payment_gateway_id')->default(config('attendize.default_payment_gateway')); $t->nullableTimestamps(); $t->softDeletes(); $t->string('name')->nullable(); $t->string('last_ip')->nullable(); $t->timestamp('last_login_date')->nullable(); $t->string('address1')->nullable(); $t->string('address2')->nullable(); $t->string('city')->nullable(); $t->string('state')->nullable(); $t->string('postal_code')->nullable(); $t->unsignedInteger('country_id')->nullable(); $t->text('email_footer')->nullable(); $t->boolean('is_active')->default(false); $t->boolean('is_banned')->default(false); $t->boolean('is_beta')->default(false); $t->string('stripe_access_token', 55)->nullable(); $t->string('stripe_refresh_token', 55)->nullable(); $t->string('stripe_secret_key', 55)->nullable(); $t->string('stripe_publishable_key', 55)->nullable(); $t->text('stripe_data_raw', 55)->nullable(); $t->foreign('timezone_id')->references('id')->on('timezones'); $t->foreign('date_format_id')->references('id')->on('date_formats'); $t->foreign('datetime_format_id')->references('id')->on('date_formats'); //$t->foreign('payment_gateway_id')->references('id')->on('payment_gateways'); $t->foreign('currency_id')->references('id')->on('currencies'); }); /* * Users Table */ Schema::create('users', function ($t) { $t->increments('id'); $t->unsignedInteger('account_id')->index(); $t->nullableTimestamps(); $t->softDeletes(); $t->string('first_name')->nullable(); $t->string('last_name')->nullable(); $t->string('phone')->nullable(); $t->string('email'); $t->string('password'); $t->string('confirmation_code'); $t->boolean('is_registered')->default(false); $t->boolean('is_confirmed')->default(false); $t->boolean('is_parent')->default(false); $t->string('remember_token', 100)->nullable(); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); Schema::create('organisers', function ($table) { $table->increments('id')->index(); $table->nullableTimestamps(); $table->softDeletes(); $table->unsignedInteger('account_id')->index(); $table->string('name'); $table->text('about'); $table->string('email'); $table->string('phone')->nullable(); $table->string('confirmation_key', 20); $table->string('facebook'); $table->string('twitter'); $table->string('logo_path')->nullable(); $table->boolean('is_email_confirmed')->default(0); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); Schema::create('events', function ($t) { $t->increments('id'); $t->string('title'); $t->string('location')->nullable(); $t->string('bg_type', 15)->default('color'); $t->string('bg_color')->default(config('attendize.event_default_bg_color')); $t->string('bg_image_path')->nullable(); $t->text('description'); $t->dateTime('start_date')->nullable(); $t->dateTime('end_date')->nullable(); $t->dateTime('on_sale_date')->nullable(); $t->integer('account_id')->unsigned()->index(); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->integer('user_id')->unsigned(); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $t->unsignedInteger('currency_id')->nullable(); $t->foreign('currency_id')->references('id')->on('currencies'); $t->decimal('sales_volume', 13, 2)->default(0); $t->decimal('organiser_fees_volume', 13, 2)->default(0); $t->decimal('organiser_fee_fixed', 13, 2)->default(0); $t->decimal('organiser_fee_percentage', 4, 3)->default(0); $t->unsignedInteger('organiser_id'); $t->foreign('organiser_id')->references('id')->on('organisers'); $t->string('venue_name'); $t->string('venue_name_full')->nullable(); $t->string('location_address', 355)->nullable(); $t->string('location_address_line_1', 355); $t->string('location_address_line_2', 355); $t->string('location_country')->nullable(); $t->string('location_country_code')->nullable(); $t->string('location_state'); $t->string('location_post_code'); $t->string('location_street_number')->nullable(); $t->string('location_lat')->nullable(); $t->string('location_long')->nullable(); $t->string('location_google_place_id')->nullable(); $t->unsignedInteger('ask_for_all_attendees_info')->default(0); $t->text('pre_order_display_message')->nullable(); $t->text('post_order_display_message')->nullable(); $t->text('social_share_text')->nullable(); $t->boolean('social_show_facebook')->default(true); $t->boolean('social_show_linkedin')->default(true); $t->boolean('social_show_twitter')->default(true); $t->boolean('social_show_email')->default(true); $t->boolean('social_show_googleplus')->default(true); $t->unsignedInteger('location_is_manual')->default(0); $t->boolean('is_live')->default(false); $t->nullableTimestamps(); $t->softDeletes(); }); /* * Users table */ Schema::create('orders', function ($t) { $t->increments('id'); $t->unsignedInteger('account_id')->index(); $t->unsignedInteger('order_status_id'); $t->nullableTimestamps(); $t->softDeletes(); $t->string('first_name'); $t->string('last_name'); $t->string('email'); $t->string('ticket_pdf_path', 155)->nullable(); $t->string('order_reference', 15); $t->string('transaction_id', 50)->nullable(); $t->decimal('discount', 8, 2)->nullable(); $t->decimal('booking_fee', 8, 2)->nullable(); $t->decimal('organiser_booking_fee', 8, 2)->nullable(); $t->date('order_date')->nullable(); $t->text('notes')->nullable(); $t->boolean('is_deleted')->default(0); $t->boolean('is_cancelled')->default(0); $t->boolean('is_partially_refunded')->default(0); $t->boolean('is_refunded')->default(0); $t->decimal('amount', 13, 2); $t->decimal('amount_refunded', 13, 2)->nullable(); $t->unsignedInteger('event_id')->index(); $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->foreign('order_status_id')->references('id')->on('order_statuses')->onDelete('no action'); }); /* * Tickets table */ Schema::create('tickets', function ($t) { $t->increments('id'); $t->nullableTimestamps(); $t->softDeletes(); $t->unsignedInteger('edited_by_user_id')->nullable(); $t->unsignedInteger('account_id')->index(); $t->unsignedInteger('order_id')->nullable(); $t->unsignedInteger('event_id')->index(); $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $t->string('title'); $t->text('description'); $t->decimal('price', 13, 2); $t->integer('max_per_person')->nullable()->default(null); $t->integer('min_per_person')->nullable()->default(null); $t->integer('quantity_available')->nullable()->default(null); $t->integer('quantity_sold')->default(0); $t->dateTime('start_sale_date')->nullable(); $t->dateTime('end_sale_date')->nullable(); $t->decimal('sales_volume', 13, 2)->default(0); $t->decimal('organiser_fees_volume', 13, 2)->default(0); $t->tinyInteger('is_paused')->default(0); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->foreign('order_id')->references('id')->on('orders'); $t->foreign('edited_by_user_id')->references('id')->on('users'); $t->unsignedInteger('public_id')->nullable()->index(); $t->unsignedInteger('user_id'); $t->foreign('user_id')->references('id')->on('users'); }); Schema::create('order_items', function ($table) { $table->increments('id'); $table->string('title', 255); $table->integer('quantity'); $table->decimal('unit_price', 13, 2); $table->decimal('unit_booking_fee', 13, 2)->nullable(); $table->unsignedInteger('order_id'); $table->foreign('order_id')->references('id')->on('orders')->onDelete('cascade'); $table->softDeletes(); }); /* * checkbox, multiselect, select, radio, text etc. */ // Schema::create('question_types', function($t) { // $t->increments('id'); // $t->string('name'); // $t->boolean('allow_multiple')->default(FALSE); // }); // // // Schema::create('questions', function($t) { // $t->nullableTimestamps(); // $t->softDeletes(); // // $t->increments('id'); // // $t->string('title', 255); // $t->text('instructions'); // $t->text('options'); // // // $t->unsignedInteger('question_type_id'); // $t->unsignedInteger('account_id')->index(); // // $t->tinyInteger('is_required')->default(0); // // // /* // * If multi select - have question options // */ // $t->foreign('question_type_id')->references('id')->on('question_types'); // $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); // // }); // // /** // * Related to each question , can have one or many // * Whats you name etc? // * // */ // Schema::create('question_options', function($t) { // $t->increments('id'); // $t->string('name'); // $t->integer('question_id')->unsigned()->index(); // $t->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); // }); // // // Schema::create('answers', function($t) { // $t->increments('id'); // // // $t->integer('question_id')->unsigned()->index(); // $t->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); // // $t->integer('ticket_id')->unsigned()->index(); // $t->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); // // $t->text('answer'); // }); // // // // // /** // * Tickets / Questions pivot table // */ // Schema::create('event_question', function($t) { // $t->increments('id'); // $t->integer('event_id')->unsigned()->index(); // $t->foreign('event_id')->references('id')->on('event')->onDelete('cascade'); // $t->integer('question_id')->unsigned()->index(); // $t->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); // }); // /* * Tickets / Orders pivot table */ Schema::create('ticket_order', function ($t) { $t->increments('id'); $t->integer('order_id')->unsigned()->index(); $t->foreign('order_id')->references('id')->on('orders')->onDelete('cascade'); $t->integer('ticket_id')->unsigned()->index(); $t->foreign('ticket_id')->references('id')->on('users')->onDelete('cascade'); }); /* * Tickets / Questions pivot table */ // Schema::create('ticket_question', function($t) { // $t->increments('id'); // $t->integer('ticket_id')->unsigned()->index(); // $t->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); // $t->integer('question_id')->unsigned()->index(); // $t->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); // }); Schema::create('event_stats', function ($table) { $table->increments('id')->index(); $table->date('date'); $table->integer('views')->default(0); $table->integer('unique_views')->default(0); $table->integer('tickets_sold')->default(0); $table->decimal('sales_volume', 13, 2)->default(0); $table->decimal('organiser_fees_volume', 13, 2)->default(0); $table->unsignedInteger('event_id')->index(); $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); }); Schema::create('attendees', function ($t) { $t->increments('id'); $t->unsignedInteger('order_id')->index(); $t->unsignedInteger('event_id')->index(); $t->unsignedInteger('ticket_id')->index(); $t->string('first_name'); $t->string('last_name'); $t->string('email'); $t->string('reference', 20); $t->integer('private_reference_number')->index(); $t->nullableTimestamps(); $t->softDeletes(); $t->boolean('is_cancelled')->default(false); $t->boolean('has_arrived')->default(false); $t->dateTime('arrival_time')->nullable(); $t->unsignedInteger('account_id')->index(); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $t->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); $t->foreign('order_id')->references('id')->on('orders')->onDelete('cascade'); }); Schema::create('messages', function ($table) { $table->increments('id'); $table->text('message'); $table->string('subject'); $table->integer('recipients')->nullable(); //ticket_id or null for all $table->unsignedInteger('account_id')->index(); $table->unsignedInteger('user_id'); $table->unsignedInteger('event_id'); $table->unsignedInteger('is_sent')->default(0); $table->dateTime('sent_at')->nullable(); $table->nullableTimestamps(); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('no action'); }); Schema::create('event_images', function ($t) { $t->increments('id'); $t->string('image_path'); $t->nullableTimestamps(); $t->unsignedInteger('event_id'); $t->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $t->unsignedInteger('account_id'); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $t->unsignedInteger('user_id'); $t->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { $tables = [ 'order_statuses', 'ticket_statuses', 'reserved_tickets', 'timezones', 'date_formats', 'datetime_formats', 'currencies', 'accounts', 'users', 'organisers', 'events', 'orders', 'tickets', 'order_items', 'ticket_order', 'event_stats', 'attendees', 'messages', 'event_images', ]; DB::statement('SET FOREIGN_KEY_CHECKS=0;'); foreach($tables as $table) { Schema::drop($table); } DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } } ```
/content/code_sandbox/database/migrations/2014_03_26_180116_create_users_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
4,503
```php <?php use App\Models\Order; use App\Models\PaymentGateway; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Schema; class AddDefaultGateways extends Migration { /** * Run the migrations. * * @return void */ public function up() { $paypal = PaymentGateway::where('name', 'PayPal_Express')->first(); //Log::info('Removing?'); if ($paypal) { // Set the Paypal gateway relationship to null to avoid errors when removing it Order::where('payment_gateway_id', $paypal->id)->update(['payment_gateway_id' => null]); Log::info('Removed'); $paypal->delete(); } Schema::table('payment_gateways', function ($table) { $table->boolean('default')->default(0); $table->string('admin_blade_template', 150)->default(''); $table->string('checkout_blade_template', 150)->default(''); }); Schema::table('orders', function ($table) { $table->string('payment_intent', 150)->default(''); }); $stripe = DB::table('payment_gateways')->where('provider_name', 'Stripe')->first(); if ($stripe) { $stripe->update([ 'admin_blade_template' => 'ManageAccount.Partials.Stripe', 'checkout_blade_template' => 'Public.ViewEvent.Partials.PaymentStripe' ]); } else { DB::table('payment_gateways')->insert( [ 'provider_name' => 'Stripe', 'provider_url' => 'path_to_url 'is_on_site' => 1, 'can_refund' => 1, 'name' => 'Stripe', 'default' => 0, 'admin_blade_template' => 'ManageAccount.Partials.Stripe', 'checkout_blade_template' => 'Public.ViewEvent.Partials.PaymentStripe' ] ); } $dummyGateway = DB::table('payment_gateways')->where('name', '=', 'Dummy')->first(); if ($dummyGateway === null) { // user doesn't exist DB::table('payment_gateways')->insert( [ 'provider_name' => 'Dummy/Test Gateway', 'provider_url' => 'none', 'is_on_site' => 1, 'can_refund' => 1, 'name' => 'Dummy', 'default' => 0, 'admin_blade_template' => '', 'checkout_blade_template' => 'Public.ViewEvent.Partials.Dummy' ] ); } $stripePaymentIntents = DB::table('payment_gateways') ->where('name', '=', 'Stripe\PaymentIntents')->first(); if ($stripePaymentIntents === null) { DB::table('payment_gateways')->insert( [ 'provider_name' => 'Stripe SCA', 'provider_url' => 'path_to_url 'is_on_site' => 0, 'can_refund' => 1, 'name' => 'Stripe\PaymentIntents', 'default' => 0, 'admin_blade_template' => 'ManageAccount.Partials.StripeSCA', 'checkout_blade_template' => 'Public.ViewEvent.Partials.PaymentStripeSCA' ] ); } } /** * Reverse the migrations. * * @return void */ public function down() { // } } ```
/content/code_sandbox/database/migrations/2019_09_04_075835_add_default_gateways.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
785
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class UpdateTicketsTableSetDefaultValue extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('tickets', function (Blueprint $table) { $table->text('description')->default('')->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('tickets', function (Blueprint $table) { $table->text('description')->default(NULL)->change(); }); } } ```
/content/code_sandbox/database/migrations/2019_11_22_025242_update_tickets_table_set_default_value.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
145
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class RemoveEventsGoogleplus extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('social_show_googleplus'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->boolean('social_show_googleplus')->default(1); }); } } ```
/content/code_sandbox/database/migrations/2021_08_27_080923_remove_events_googleplus.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
145
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddSortOrderTicketsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('tickets', function (Blueprint $table) { $table->integer('sort_order')->default(0); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('tickets', function (Blueprint $table) { $table->dropColumn('sort_order'); }); } } ```
/content/code_sandbox/database/migrations/2016_05_28_084338_add_sort_order_tickets_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
136
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class ChangePrivateReferenceNumberColumnType extends Migration { /** * Run the migrations. * Change Private Reference Number from INT to VARCHAR ColumnType * and increases the character count to 15 * * @return void */ public function up() { Schema::table('attendees', function (Blueprint $table) { $table->string('private_reference_number', 15)->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { // Schema::table('attendees', function ($table) { // $table->integer('private_reference_number')->change(); // }); } } ```
/content/code_sandbox/database/migrations/2019_04_05_180853_change_private_reference_number_column_type.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
174
```php <?php use Illuminate\Database\Migrations\Migration; class AddAffiliatesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('affiliates', function ($table) { $table->increments('id'); $table->string('name', 125); $table->integer('visits'); $table->integer('tickets_sold')->default(0); $table->decimal('sales_volume', 10, 2)->default(0); $table->timestamp('last_visit'); $table->unsignedInteger('account_id')->index(); $table->unsignedInteger('event_id'); $table->nullableTimestamps(); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('affiliates'); } } ```
/content/code_sandbox/database/migrations/2014_11_07_132018_add_affiliates_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
241
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class UpdateQuestionsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('questions', function (Blueprint $table) { $table->integer('sort_order')->default(1); $table->tinyInteger('is_enabled')->default(1); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('questions', function (Blueprint $table) { $table->dropColumn('sort_order'); $table->dropColumn('is_enabled'); }); } } ```
/content/code_sandbox/database/migrations/2016_05_16_142730_update_questions_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
158
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateAttendeesQuestions extends Migration { /** * Run the migrations. * * @access public * @return void */ public function up() { /** * Checkbox, dropdown, radio, text etc. */ Schema::create('question_types', function (Blueprint $table) { $table->increments('id'); $table->string('alias'); $table->string('name'); $table->boolean('has_options')->default(false); $table->boolean('allow_multiple')->default(false); }); /** * The questions. */ Schema::create('questions', function (Blueprint $table) { $table->increments('id'); $table->string('title', 255); $table->text('instructions'); $table->unsignedInteger('question_type_id'); $table->unsignedInteger('account_id')->index(); $table->tinyInteger('is_required')->default(0); $table->timestamps(); $table->softDeletes(); $table->foreign('question_type_id')->references('id')->on('question_types'); $table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); }); /** * Used for the questions that allow options (checkbox, radio, dropdown). */ Schema::create('question_options', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->integer('question_id')->unsigned()->index(); $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); }); /** * Event / Question pivot table. */ Schema::create('event_question', function(Blueprint $table) { $table->increments('id'); $table->integer('event_id')->unsigned()->index(); $table->integer('question_id')->unsigned()->index(); $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); }); /** * Question / Ticket pivot table. */ Schema::create('question_ticket', function (Blueprint $table) { $table->increments('id'); $table->integer('question_id')->unsigned()->index(); $table->integer('ticket_id')->unsigned()->index(); $table->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); $table->foreign('question_id')->references('id')->on('questions')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @access public * @return void */ public function down() { $tables = [ 'question_types', 'questions', 'question_options', 'event_question', 'question_ticket', ]; DB::statement('SET FOREIGN_KEY_CHECKS=0;'); foreach ($tables as $table) { Schema::drop($table); } DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } } ```
/content/code_sandbox/database/migrations/2016_03_26_103318_create_attendees_questions.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
691
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class OrderPageUpdate extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->string('questions_collection_type', 10)->default('buyer'); // buyer or attendee $table->integer('checkout_timeout_after')->default(8); // timeout in mins for checkout }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn(['checkout_timeout_after', 'questions_collection_type']); }); } } ```
/content/code_sandbox/database/migrations/2016_04_03_172528_order_page_update.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
170
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class UpgradeFailedJobsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('failed_jobs', function (Blueprint $table) { $table->bigIncrements('id')->change(); $table->longText('payload')->nullable()->change(); $table->longText('exception')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('failed_jobs', function (Blueprint $table) { $table->increments('id')->change(); $table->text('payload')->change(); $table->dropColumn('exception'); }); } } ```
/content/code_sandbox/database/migrations/2019_08_19_000000_upgrade_failed_jobs_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
185
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class RemoveEventRevenueVolumes extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->dropColumn([ 'sales_volume', 'organiser_fees_volume', ]); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->decimal('sales_volume', 13, 2)->default(0); $table->decimal('organiser_fees_volume', 13, 2)->default(0); }); } } ```
/content/code_sandbox/database/migrations/2019_05_27_134053_remove_event_revenue_volumes.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
181
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use App\Models\Message; class FixMessagesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('messages', function ($table) { $table->string('recipients')->nullable()->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Message::where('recipients', null)->delete(); Schema::table('messages', function ($table) { $table->string('recipients')->nullable(false)->change(); }); } } ```
/content/code_sandbox/database/migrations/2016_05_12_143324_fix_messages_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
151
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class AddGtmFieldToEvent extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('events', function (Blueprint $table) { $table->string('google_tag_manager_code', 20)->after('ticket_sub_text_color')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('events', function (Blueprint $table) { $table->dropColumn('google_tag_manager_code'); }); } } ```
/content/code_sandbox/database/migrations/2019_05_14_122256_add_gtm_field_to_event.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
155
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class FixTicketOrderTableForeignKeyConstraints extends Migration { /** * Run the migrations. * * @return void */ public function up() { if (env('APP_ENV') !== 'testing') { Schema::table('ticket_order', function (Blueprint $table) { $table->dropForeign('ticket_order_ticket_id_foreign'); $table->foreign('ticket_id')->references('id')->on('tickets')->onDelete('cascade'); }); } } /** * Reverse the migrations. * * @return void */ public function down() { // Do nothing. } } ```
/content/code_sandbox/database/migrations/2019_05_26_181318_fix_ticket_order_table_foreign_key_constraints.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
159
```php <?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class RemoveInstructionsFieldQuestionsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('questions', function (Blueprint $table) { $table->dropColumn('instructions'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('questions', function (Blueprint $table) { $table->string('instructions'); }); } } ```
/content/code_sandbox/database/migrations/2016_05_05_201200_remove_instructions_field_questions_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
130
```php <?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateEventAccessCodesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('event_access_codes', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('event_id'); $table->string('code')->default(''); $table->timestamps(); $table->softDeletes(); // Add events table foreign key $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('event_access_codes'); } } ```
/content/code_sandbox/database/migrations/2019_01_14_124052_create_event_access_codes_table.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
184
```php <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class UpdateOrganisersTableSetFieldsNullable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('organisers', function (Blueprint $table) { $table->text('about')->nullable()->change(); $table->string('tax_id')->nullable()->change(); $table->string('tax_name')->nullable()->change(); $table->string('tax_value')->nullable()->change(); $table->string('facebook')->nullable()->change(); $table->string('twitter')->nullable()->change(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('organisers', function (Blueprint $table) { $table->text('about')->nullable(false)->default('')->change(); $table->string('tax_id')->nullable(false)->default('')->change(); $table->string('tax_name')->nullable(false)->default('')->change(); $table->string('tax_value')->nullable(false)->default('')->change(); $table->string('facebook')->nullable(false)->default('')->change(); $table->string('twitter')->nullable(false)->default('')->change(); }); } } ```
/content/code_sandbox/database/migrations/2019_09_18_175630_update_organisers_table_set_fields_nullable.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
297
```php <?php use Illuminate\Database\Seeder; class PaymentGatewaySeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $dummyGateway = DB::table('payment_gateways')->where('name', '=', 'Dummy')->first(); if ($dummyGateway === null) { // user doesn't exist DB::table('payment_gateways')->insert( [ 'provider_name' => 'Dummy/Test Gateway', 'provider_url' => 'none', 'is_on_site' => 1, 'can_refund' => 1, 'name' => 'Dummy', 'default' => 0, 'admin_blade_template' => '', 'checkout_blade_template' => 'Public.ViewEvent.Partials.Dummy' ] ); } $stripe = DB::table('payment_gateways')->where('name', '=', 'Stripe')->first(); if ($stripe === null) { DB::table('payment_gateways')->insert( [ 'name' => 'Stripe', 'provider_name' => 'Stripe', 'provider_url' => 'path_to_url 'is_on_site' => 1, 'can_refund' => 1, 'default' => 0, 'admin_blade_template' => 'ManageAccount.Partials.Stripe', 'checkout_blade_template' => 'Public.ViewEvent.Partials.PaymentStripe' ] ); } $stripePaymentIntents = DB::table('payment_gateways')->where('name', '=', 'Stripe\PaymentIntents')->first(); if ($stripePaymentIntents === null) { DB::table('payment_gateways')->insert( [ 'provider_name' => 'Stripe SCA', 'provider_url' => 'path_to_url 'is_on_site' => 0, 'can_refund' => 1, 'name' => 'Stripe\PaymentIntents', 'default' => 0, 'admin_blade_template' => 'ManageAccount.Partials.StripeSCA', 'checkout_blade_template' => 'Public.ViewEvent.Partials.PaymentStripeSCA' ] ); } } } ```
/content/code_sandbox/database/seeds/PaymentGatewaySeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
482
```php <?php use App\Models\Account; use App\Models\Attendee; use App\Models\Event; use App\Models\EventAccessCodes; use App\Models\EventStats; use App\Models\Order; use App\Models\OrderItem; use App\Models\Organiser; use App\Models\Ticket; use App\Models\User; use Illuminate\Database\Seeder; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Hash; class LocalTestSeeder extends Seeder { /** * Run the seeds to allow for local database test cases. * @return void */ public function run() { Eloquent::unguard(); // Setup Test account $this->out("<info>Setting up basic settings</info>"); $account = $this->setupTestAccountWithTestStripeDetails(); $user = $this->setupTestAttendizeUserWithLoginDetails($account); $this->setupNonTaxOrganisation($account, $user); $this->setupTaxOrganisation($account, $user); // Adds VAT @15% per transaction $this->setupTaxOrganisationWithFees($account, $user); // Write final part about test user logins $this->command->alert( sprintf("Local Test Seed Finished" . "\n\nYou can log in with the Test User using" . "\n\nu: %s\np: %s\n\n", $user->email, 'pass') ); } /** * @param string $message */ protected function out($message) { $this->command->getOutput()->writeln($message); } /** * @param $account * @param $user */ protected function setupNonTaxOrganisation($account, $user) { // Organiser with no tax (organisers) $this->out("<info>Seeding Organiser (no tax)</info>"); $organiserNoTax = factory(Organiser::class)->create([ 'account_id' => $account->id, 'name' => 'Test Organiser (No Tax)', 'charge_tax' => false, 'tax_name' => '', 'tax_value' => 0.00 ]); // Event (events) $this->out("<info>Seeding event</info>"); $event = factory(Event::class)->create([ 'account_id' => $account->id, 'user_id' => $user->id, 'organiser_id' => $organiserNoTax->id, 'title' => 'Local Orchid Show', 'is_live' => true, ]); // Setup event access codes to allow testing hidden code functionality on the tickets public page $eventAccessCode = $this->setupEventAccessCodeForHiddenTickets($event); // Setup two tickets, one visible and one hidden $this->out("<info>Seeding visible ticket</info>"); $visibleTicket = factory(Ticket::class)->create([ 'user_id' => $user->id, 'edited_by_user_id' => $user->id, 'account_id' => $account->id, 'order_id' => null, // We'll create the orders on these later 'event_id' => $event->id, 'title' => 'Visible Ticket', 'price' => 100.00, 'is_hidden' => false, ]); $this->out("<info>Seeding hidden ticket</info>"); $hiddenTicket = factory(Ticket::class)->create([ 'user_id' => $user->id, 'edited_by_user_id' => $user->id, 'account_id' => $account->id, 'order_id' => null, // We'll create the orders on these later 'event_id' => $event->id, 'title' => 'Hidden Ticket', 'price' => 100.00, 'is_hidden' => true, ]); // Attach unlock code to hidden ticket $this->out("<info>Attaching access code to hidden ticket</info>"); $hiddenTicket->event_access_codes()->attach($eventAccessCode); // Event Stats $this->out("<info>Seeding Event Stats</info>"); factory(EventStats::class)->create([ 'date' => Carbon::now()->format('Y-m-d'), 'views' => 0, 'unique_views' => 0, 'tickets_sold' => 6, 'sales_volume' => 600.00, 'event_id' => $event->id, ]); // Orders (order_items, ticket_order) as normie $this->out("<info>Seeding single attendee order</info>"); $singleAttendeeOrder = factory(Order::class)->create([ 'account_id' => $account->id, 'order_status_id' => 1, // Completed Order 'discount' => 0.00, 'booking_fee' => 0.00, 'organiser_booking_fee' => 0.00, 'amount' => 100.00, 'event_id' => $event->id, 'is_payment_received' => true, ]); $visibleTicket->order_id = $singleAttendeeOrder->id; $visibleTicket->quantity_sold = 1; $visibleTicket->sales_volume = 100.00; $visibleTicket->save(); $this->out("<info>Attaching visible ticket to single attendee order</info>"); $singleAttendeeOrder->tickets()->attach($visibleTicket); $this->out("<info>Seeding single attendee order item</info>"); factory(OrderItem::class)->create([ 'title' => $visibleTicket->title, 'quantity' => 1, 'unit_price' => 100.00, 'unit_booking_fee' => 0.00, 'order_id' => $singleAttendeeOrder->id, ]); $this->out("<info>Seeding single attendee</info>"); factory(Attendee::class)->create([ 'order_id' => $singleAttendeeOrder->id, 'event_id' => $event->id, 'ticket_id' => $visibleTicket->id, 'account_id' => $account->id, ]); $this->out("<info>Seeding multiple attendees order</info>"); $multipleAttendeeOrder = factory(Order::class)->create([ 'account_id' => $account->id, 'order_status_id' => 1, // Completed Order 'discount' => 0.00, 'booking_fee' => 0.00, 'organiser_booking_fee' => 0.00, 'amount' => 500.00, 'event_id' => $event->id, 'is_payment_received' => true, ]); $hiddenTicket->order_id = $multipleAttendeeOrder->id; $hiddenTicket->quantity_sold = 5; $hiddenTicket->sales_volume = 500.00; $hiddenTicket->save(); $this->out("<info>Attaching hidden ticket to multiple attendees order</info>"); $multipleAttendeeOrder->tickets()->attach($hiddenTicket); $this->out("<info>Seeding multiple attendees order item</info>"); factory(OrderItem::class)->create([ 'title' => $visibleTicket->title, 'quantity' => 5, 'unit_price' => 100.00, 'unit_booking_fee' => 0.00, 'order_id' => $multipleAttendeeOrder->id, ]); $this->out("<info>Seeding multiple attendees</info>"); factory(Attendee::class, 5)->create([ 'order_id' => $multipleAttendeeOrder->id, 'event_id' => $event->id, 'ticket_id' => $hiddenTicket->id, 'account_id' => $account->id, ]); } /** * @param $account * @param $user */ protected function setupTaxOrganisation($account, $user) { // Organiser with no tax (organisers) $this->out("<info>Seeding Organiser (with tax)</info>"); $organiserTax = factory(Organiser::class)->create([ 'account_id' => $account->id, 'name' => 'Test Organiser (with tax)', 'charge_tax' => true, 'tax_name' => 'VAT', 'tax_value' => 15.00 ]); // Event (events) $this->out("<info>Seeding event</info>"); $event = factory(Event::class)->create([ 'account_id' => $account->id, 'user_id' => $user->id, 'organiser_id' => $organiserTax->id, 'title' => 'Local Bonsai Show', 'is_live' => true, ]); $eventAccessCode = $this->setupEventAccessCodeForHiddenTickets($event); // Setup two tickets, one visible and one hidden $this->out("<info>Seeding visible ticket</info>"); $visibleTicket = factory(Ticket::class)->create([ 'user_id' => $user->id, 'edited_by_user_id' => $user->id, 'account_id' => $account->id, 'order_id' => null, // We'll create the orders on these later 'event_id' => $event->id, 'title' => 'Visible Ticket', 'price' => 100.00, 'is_hidden' => false, ]); $this->out("<info>Seeding hidden ticket</info>"); $hiddenTicket = factory(Ticket::class)->create([ 'user_id' => $user->id, 'edited_by_user_id' => $user->id, 'account_id' => $account->id, 'order_id' => null, // We'll create the orders on these later 'event_id' => $event->id, 'title' => 'Hidden Ticket', 'price' => 50.00, 'is_hidden' => true, ]); // Attach unlock code to hidden ticket $this->out("<info>Attaching access code to hidden ticket</info>"); $hiddenTicket->event_access_codes()->attach($eventAccessCode); // Event Stats $this->out("<info>Seeding Event Stats</info>"); factory(EventStats::class)->create([ 'date' => Carbon::now()->format('Y-m-d'), 'views' => 0, 'unique_views' => 0, 'tickets_sold' => 6, 'sales_volume' => 350.00, 'event_id' => $event->id, ]); // Orders (order_items, ticket_order) as normie $this->out("<info>Seeding single attendee order</info>"); $singleAttendeeOrder = factory(Order::class)->create([ 'account_id' => $account->id, 'order_status_id' => 1, // Completed Order 'discount' => 0.00, 'booking_fee' => 0.00, 'organiser_booking_fee' => 0.00, 'amount' => 100.00, 'event_id' => $event->id, 'is_payment_received' => true, 'taxamt' => 15.00, ]); $visibleTicket->order_id = $singleAttendeeOrder->id; $visibleTicket->quantity_sold = 1; $visibleTicket->sales_volume = 100.00; $visibleTicket->save(); $this->out("<info>Attaching visible ticket to single attendee order</info>"); $singleAttendeeOrder->tickets()->attach($visibleTicket); $this->out("<info>Seeding single attendee order item</info>"); factory(OrderItem::class)->create([ 'title' => $visibleTicket->title, 'quantity' => 1, 'unit_price' => 100.00, 'unit_booking_fee' => 0.00, 'order_id' => $singleAttendeeOrder->id, ]); $this->out("<info>Seeding single attendee</info>"); factory(Attendee::class)->create([ 'order_id' => $singleAttendeeOrder->id, 'event_id' => $event->id, 'ticket_id' => $visibleTicket->id, 'account_id' => $account->id, ]); $this->out("<info>Seeding multiple attendees order</info>"); $multipleAttendeeOrder = factory(Order::class)->create([ 'account_id' => $account->id, 'order_status_id' => 1, // Completed Order 'discount' => 0.00, 'booking_fee' => 0.00, 'organiser_booking_fee' => 0.00, 'amount' => 250.00, 'event_id' => $event->id, 'is_payment_received' => true, 'taxamt' => 37.5, ]); $hiddenTicket->order_id = $multipleAttendeeOrder->id; $hiddenTicket->quantity_sold = 5; $hiddenTicket->sales_volume = 250.00; $hiddenTicket->save(); $this->out("<info>Attaching hidden ticket to multiple attendees order</info>"); $multipleAttendeeOrder->tickets()->attach($hiddenTicket); $this->out("<info>Seeding multiple attendees order item</info>"); factory(OrderItem::class)->create([ 'title' => $hiddenTicket->title, 'quantity' => 5, 'unit_price' => 50.00, 'unit_booking_fee' => 0.00, 'order_id' => $multipleAttendeeOrder->id, ]); $this->out("<info>Seeding multiple attendees</info>"); factory(Attendee::class, 5)->create([ 'order_id' => $multipleAttendeeOrder->id, 'event_id' => $event->id, 'ticket_id' => $hiddenTicket->id, 'account_id' => $account->id, ]); } protected function setupTaxOrganisationWithFees($account, $user) { // Organiser with tax and fees (organisers) $this->out("<info>Seeding Organiser (with tax and fees)</info>"); $organiserTaxAndFees = factory(Organiser::class)->create([ 'account_id' => $account->id, 'name' => 'Test Organiser (with tax and fees)', 'charge_tax' => true, 'tax_name' => 'VAT', 'tax_value' => 20.00 ]); // Event (events) $this->out("<info>Seeding event with percentage fees</info>"); $eventWithPercentageFee = factory(Event::class)->create([ 'account_id' => $account->id, 'user_id' => $user->id, 'organiser_id' => $organiserTaxAndFees->id, 'organiser_fee_percentage' => 5.0, 'title' => 'Local Clivia Show', 'is_live' => true, ]); // Setup tickets, single and multiple order $this->out("<info>Seeding ticket with organiser fee</info>"); $ticketWithPercentageFee = factory(Ticket::class)->create([ 'user_id' => $user->id, 'edited_by_user_id' => $user->id, 'account_id' => $account->id, 'order_id' => null, // We'll create the orders on these later 'event_id' => $eventWithPercentageFee->id, 'title' => 'Ticket with organiser fee', 'price' => 100.00, 'organiser_fees_volume' => 5.00, 'is_hidden' => false, ]); // Event Stats $this->out("<info>Seeding Event Stats</info>"); factory(EventStats::class)->create([ 'date' => Carbon::now()->format('Y-m-d'), 'views' => 0, 'unique_views' => 0, 'tickets_sold' => 1, 'sales_volume' => 100.00, 'organiser_fees_volume' => 5.00, 'event_id' => $eventWithPercentageFee->id, ]); // Orders (order_items, ticket_order) as normie $this->out("<info>Seeding single attendee order</info>"); $singleAttendeeOrder = factory(Order::class)->create([ 'account_id' => $account->id, 'order_status_id' => 1, // Completed Order 'discount' => 0.00, 'booking_fee' => 0.00, 'organiser_booking_fee' => 5.00, 'amount' => 100.00, 'event_id' => $eventWithPercentageFee->id, 'is_payment_received' => true, 'taxamt' => 21.00, ]); $ticketWithPercentageFee->order_id = $singleAttendeeOrder->id; $ticketWithPercentageFee->quantity_sold = 1; $ticketWithPercentageFee->sales_volume = 100.00; $ticketWithPercentageFee->save(); $this->out("<info>Attaching ticket with percentage fee to single attendee order</info>"); $singleAttendeeOrder->tickets()->attach($ticketWithPercentageFee); $this->out("<info>Seeding single attendee order item</info>"); factory(OrderItem::class)->create([ 'title' => $ticketWithPercentageFee->title, 'quantity' => 1, 'unit_price' => 100.00, 'unit_booking_fee' => 5.00, 'order_id' => $singleAttendeeOrder->id, ]); $this->out("<info>Seeding single attendee</info>"); factory(Attendee::class)->create([ 'order_id' => $singleAttendeeOrder->id, 'event_id' => $eventWithPercentageFee->id, 'ticket_id' => $ticketWithPercentageFee->id, 'account_id' => $account->id, ]); } /** * @param $account * @return mixed */ protected function setupTestAttendizeUserWithLoginDetails($account) { $this->out("<info>Seeding User</info>"); $user = factory(User::class)->create([ 'account_id' => $account->id, 'email' => 'local@test.com', 'password' => Hash::make('pass'), 'is_parent' => true, // Top level user 'is_registered' => true, 'is_confirmed' => true, ]); return $user; } /** * @return mixed */ protected function setupTestAccountWithTestStripeDetails() { $this->out("<info>Seeding account</info>"); $account = factory(Account::class)->create([ 'name' => 'Local Integration Test Account', 'timezone_id' => 38, // Brussels 'currency_id' => 2, // Euro ]); // Set test stripe details $this->out("<info>Seeding account payment test details</info>"); DB::table('account_payment_gateways')->insert([ 'account_id' => $account->id, 'payment_gateway_id' => 1, 'config' => '{"apiKey":"","publishableKey":""}', ]); return $account; } /** * @param $event * @return mixed */ protected function setupEventAccessCodeForHiddenTickets($event) { // Setup event access codes to allow testing hidden code functionality on the tickets public page $this->out("<info>Seeding event access code</info>"); return factory(EventAccessCodes::class)->create([ 'event_id' => $event->id, 'code' => 'SHOWME', ]); } } ```
/content/code_sandbox/database/seeds/LocalTestSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
4,425
```php <?php use Illuminate\Database\Seeder; class TicketStatusSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $ticket_statuses = [ [ 'id' => 1, 'name' => 'Sold Out', ], [ 'id' => 2, 'name' => 'Sales Have Ended', ], [ 'id' => 3, 'name' => 'Not On Sale Yet', ], [ 'id' => 4, 'name' => 'On Sale', ], [ 'id' => 5, 'name' => 'On Sale', ], ]; DB::table('ticket_statuses')->insert($ticket_statuses); } } ```
/content/code_sandbox/database/seeds/TicketStatusSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
175
```php <?php use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run() { Eloquent::unguard(); $this->call('CountriesSeeder'); $this->call('CurrencySeeder'); $this->call('OrderStatusSeeder'); $this->call('PaymentGatewaySeeder'); $this->call('QuestionTypesSeeder'); $this->call('TicketStatusSeeder'); $this->call('TimezoneSeeder'); } } ```
/content/code_sandbox/database/seeds/DatabaseSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
121
```php <?php use Illuminate\Database\Seeder; class TimezoneSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // \App\Models\DateTimeFormat::create([ // 'format' => 'd/M/Y g:i a', // 'picker_format' => '', // 'label' => '10/Mar/2016' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'd-M-Y g:i a', // 'picker_format' => '', // 'label' => '10-Mar-2016' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'd/F/Y g:i a', // 'picker_format' => '', // 'label' => '10/March/2016' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'd-F-Y g:i a', // 'picker_format' => '', // 'label' => '10-March-2016' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'M j, Y g:i a', // 'picker_format' => '', // 'label' => 'Mar 10, 2016 6:15 pm' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'F j, Y g:i a', // 'picker_format' => '', // 'label' => 'March 10, 2016 6:15 pm' // ]); // \App\Models\DateTimeFormat::create([ // 'format' => 'D M jS, Y g:ia', // 'picker_format' => '', // 'label' => 'Mon March 10th, 2016 6:15 pm' // ]); // \App\Models\DateFormat::create([ // 'format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013']); // \App\Models\DateFormat::create([ // 'format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013']); // \App\Models\DateFormat::create([ // 'format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013']); // \App\Models\DateFormat::create([ // 'format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013']); // \App\Models\DateFormat::create([ // 'format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013']); // \App\Models\DateFormat::create([ // 'format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013']); // \App\Models\DateFormat::create([ // 'format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013']); $timezones = [ 'Pacific/Midway' => '(GMT-11:00) Midway Island', 'US/Samoa' => '(GMT-11:00) Samoa', 'US/Hawaii' => '(GMT-10:00) Hawaii', 'US/Alaska' => '(GMT-09:00) Alaska', 'US/Pacific' => '(GMT-08:00) Pacific Time (US &amp; Canada)', 'America/Tijuana' => '(GMT-08:00) Tijuana', 'US/Arizona' => '(GMT-07:00) Arizona', 'US/Mountain' => '(GMT-07:00) Mountain Time (US &amp; Canada)', 'America/Chihuahua' => '(GMT-07:00) Chihuahua', 'America/Mazatlan' => '(GMT-07:00) Mazatlan', 'America/Mexico_City' => '(GMT-06:00) Mexico City', 'America/Monterrey' => '(GMT-06:00) Monterrey', 'Canada/Saskatchewan' => '(GMT-06:00) Saskatchewan', 'US/Central' => '(GMT-06:00) Central Time (US &amp; Canada)', 'US/Eastern' => '(GMT-05:00) Eastern Time (US &amp; Canada)', 'US/East-Indiana' => '(GMT-05:00) Indiana (East)', 'America/Bogota' => '(GMT-05:00) Bogota', 'America/Lima' => '(GMT-05:00) Lima', 'America/Caracas' => '(GMT-04:30) Caracas', 'Canada/Atlantic' => '(GMT-04:00) Atlantic Time (Canada)', 'America/La_Paz' => '(GMT-04:00) La Paz', 'America/Santiago' => '(GMT-04:00) Santiago', 'Canada/Newfoundland' => '(GMT-03:30) Newfoundland', 'America/Buenos_Aires' => '(GMT-03:00) Buenos Aires', 'Greenland' => '(GMT-03:00) Greenland', 'Atlantic/Stanley' => '(GMT-02:00) Stanley', 'Atlantic/Azores' => '(GMT-01:00) Azores', 'Atlantic/Cape_Verde' => '(GMT-01:00) Cape Verde Is.', 'Africa/Casablanca' => '(GMT) Casablanca', 'Europe/Dublin' => '(GMT) Dublin', 'Europe/Lisbon' => '(GMT) Lisbon', 'Europe/London' => '(GMT) London', 'Africa/Monrovia' => '(GMT) Monrovia', 'Europe/Amsterdam' => '(GMT+01:00) Amsterdam', 'Europe/Belgrade' => '(GMT+01:00) Belgrade', 'Europe/Berlin' => '(GMT+01:00) Berlin', 'Europe/Bratislava' => '(GMT+01:00) Bratislava', 'Europe/Brussels' => '(GMT+01:00) Brussels', 'Europe/Budapest' => '(GMT+01:00) Budapest', 'Europe/Copenhagen' => '(GMT+01:00) Copenhagen', 'Europe/Ljubljana' => '(GMT+01:00) Ljubljana', 'Europe/Madrid' => '(GMT+01:00) Madrid', 'Europe/Paris' => '(GMT+01:00) Paris', 'Europe/Prague' => '(GMT+01:00) Prague', 'Europe/Rome' => '(GMT+01:00) Rome', 'Europe/Sarajevo' => '(GMT+01:00) Sarajevo', 'Europe/Skopje' => '(GMT+01:00) Skopje', 'Europe/Stockholm' => '(GMT+01:00) Stockholm', 'Europe/Vienna' => '(GMT+01:00) Vienna', 'Europe/Warsaw' => '(GMT+01:00) Warsaw', 'Europe/Zagreb' => '(GMT+01:00) Zagreb', 'Europe/Athens' => '(GMT+02:00) Athens', 'Europe/Bucharest' => '(GMT+02:00) Bucharest', 'Africa/Cairo' => '(GMT+02:00) Cairo', 'Africa/Harare' => '(GMT+02:00) Harare', 'Europe/Helsinki' => '(GMT+02:00) Helsinki', 'Europe/Istanbul' => '(GMT+02:00) Istanbul', 'Asia/Jerusalem' => '(GMT+02:00) Jerusalem', 'Europe/Kiev' => '(GMT+02:00) Kyiv', 'Europe/Minsk' => '(GMT+02:00) Minsk', 'Europe/Riga' => '(GMT+02:00) Riga', 'Europe/Sofia' => '(GMT+02:00) Sofia', 'Europe/Tallinn' => '(GMT+02:00) Tallinn', 'Europe/Vilnius' => '(GMT+02:00) Vilnius', 'Asia/Baghdad' => '(GMT+03:00) Baghdad', 'Asia/Kuwait' => '(GMT+03:00) Kuwait', 'Africa/Nairobi' => '(GMT+03:00) Nairobi', 'Asia/Riyadh' => '(GMT+03:00) Riyadh', 'Asia/Tehran' => '(GMT+03:30) Tehran', 'Europe/Moscow' => '(GMT+04:00) Moscow', 'Asia/Baku' => '(GMT+04:00) Baku', 'Europe/Volgograd' => '(GMT+04:00) Volgograd', 'Asia/Muscat' => '(GMT+04:00) Muscat', 'Asia/Tbilisi' => '(GMT+04:00) Tbilisi', 'Asia/Yerevan' => '(GMT+04:00) Yerevan', 'Asia/Kabul' => '(GMT+04:30) Kabul', 'Asia/Karachi' => '(GMT+05:00) Karachi', 'Asia/Tashkent' => '(GMT+05:00) Tashkent', 'Asia/Kolkata' => '(GMT+05:30) Kolkata', 'Asia/Kathmandu' => '(GMT+05:45) Kathmandu', 'Asia/Yekaterinburg' => '(GMT+06:00) Ekaterinburg', 'Asia/Almaty' => '(GMT+06:00) Almaty', 'Asia/Dhaka' => '(GMT+06:00) Dhaka', 'Asia/Novosibirsk' => '(GMT+07:00) Novosibirsk', 'Asia/Bangkok' => '(GMT+07:00) Bangkok', 'Asia/Jakarta' => '(GMT+07:00) Jakarta', 'Asia/Krasnoyarsk' => '(GMT+08:00) Krasnoyarsk', 'Asia/Chongqing' => '(GMT+08:00) Chongqing', 'Asia/Hong_Kong' => '(GMT+08:00) Hong Kong', 'Asia/Kuala_Lumpur' => '(GMT+08:00) Kuala Lumpur', 'Australia/Perth' => '(GMT+08:00) Perth', 'Asia/Singapore' => '(GMT+08:00) Singapore', 'Asia/Taipei' => '(GMT+08:00) Taipei', 'Asia/Ulaanbaatar' => '(GMT+08:00) Ulaan Bataar', 'Asia/Urumqi' => '(GMT+08:00) Urumqi', 'Asia/Irkutsk' => '(GMT+09:00) Irkutsk', 'Asia/Seoul' => '(GMT+09:00) Seoul', 'Asia/Tokyo' => '(GMT+09:00) Tokyo', 'Australia/Adelaide' => '(GMT+09:30) Adelaide', 'Australia/Darwin' => '(GMT+09:30) Darwin', 'Asia/Yakutsk' => '(GMT+10:00) Yakutsk', 'Australia/Brisbane' => '(GMT+10:00) Brisbane', 'Australia/Canberra' => '(GMT+10:00) Canberra', 'Pacific/Guam' => '(GMT+10:00) Guam', 'Australia/Hobart' => '(GMT+10:00) Hobart', 'Australia/Melbourne' => '(GMT+10:00) Melbourne', 'Pacific/Port_Moresby' => '(GMT+10:00) Port Moresby', 'Australia/Sydney' => '(GMT+10:00) Sydney', 'Asia/Vladivostok' => '(GMT+11:00) Vladivostok', 'Asia/Magadan' => '(GMT+12:00) Magadan', 'Pacific/Auckland' => '(GMT+12:00) Auckland', 'Pacific/Fiji' => '(GMT+12:00) Fiji', ]; foreach ($timezones as $name => $location) { \App\Models\Timezone::create(['name' => $name, 'location' => $location]); } } } ```
/content/code_sandbox/database/seeds/TimezoneSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
2,834
```php <?php use Illuminate\Database\Seeder; class CountriesSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { //Empty the countries table DB::table('countries')->delete(); //Get all of the countries $countries = json_decode(file_get_contents(database_path().'/seeds/countries.json'), true); foreach ($countries as $countryId => $country) { DB::table('countries')->insert([ 'id' => $countryId, 'capital' => ((isset($country['capital'])) ? $country['capital'] : null), 'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null), 'country_code' => $country['country-code'], 'currency' => ((isset($country['currency'])) ? $country['currency'] : null), 'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null), 'currency_sub_unit' => ((isset($country['currency_sub_unit'])) ? $country['currency_sub_unit'] : null), 'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null), 'iso_3166_2' => $country['iso_3166_2'], 'iso_3166_3' => $country['iso_3166_3'], 'name' => $country['name'], 'region_code' => $country['region-code'], 'sub_region_code' => $country['sub-region-code'], 'eea' => (bool) $country['eea'], ]); } } } ```
/content/code_sandbox/database/seeds/CountriesSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
382
```php <?php use Illuminate\Database\Seeder; class OrderStatusSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $order_statuses = [ [ 'id' => 1, 'name' => 'Completed', ], [ 'id' => 2, 'name' => 'Refunded', ], [ 'id' => 3, 'name' => 'Partially Refunded', ], [ 'id' => 4, 'name' => 'Cancelled', ], ]; DB::table('order_statuses')->insert($order_statuses); } } ```
/content/code_sandbox/database/seeds/OrderStatusSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
151
```php <?php use Illuminate\Database\Seeder; class QuestionTypesSeeder extends Seeder { /** * Run the database seeds. * * @access public * @return void */ public function run() { DB::table('question_types')->insert([ [ 'id' => 1, 'alias' => 'text', 'name' => 'Single-line text box', 'has_options' => 0, 'allow_multiple' => 0, ], [ 'id' => 2, 'alias' => 'textarea', 'name' => 'Multi-line text box', 'has_options' => 0, 'allow_multiple' => 0, ], [ 'id' => 3, 'alias' => 'dropdown', 'name' => 'Dropdown (single selection)', 'has_options' => 1, 'allow_multiple' => 0, ], [ 'id' => 4, 'alias' => 'dropdown_multiple', 'name' => 'Dropdown (multiple selection)', 'has_options' => 1, 'allow_multiple' => 1, ], [ 'id' => 5, 'alias' => 'checkbox', 'name' => 'Checkbox', 'has_options' => 1, 'allow_multiple' => 1, ], [ 'id' => 6, 'alias' => 'radio', 'name' => 'Radio input', 'has_options' => 1, 'allow_multiple' => 0, ], ]); } } ```
/content/code_sandbox/database/seeds/QuestionTypesSeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
354
```php <?php namespace App\Services; use App\Models\Event; class Order { /** * @var float */ private $orderTotal; /** * @var float */ private $totalBookingFee; /** * @var Event */ private $event; /** * @var float */ public $orderTotalWithBookingFee; /** * @var float */ public $taxAmount; /** * @var float */ public $grandTotal; /** * Order constructor. * @param $orderTotal * @param $totalBookingFee * @param $event */ public function __construct($orderTotal, $totalBookingFee, $event) { $this->orderTotal = $orderTotal; $this->totalBookingFee = $totalBookingFee; $this->event = $event; } /** * Calculates the final costs for an event and sets the various totals */ public function calculateFinalCosts() { $this->orderTotalWithBookingFee = $this->orderTotal + $this->totalBookingFee; if ($this->event->organiser->charge_tax == 1) { $this->taxAmount = ($this->orderTotalWithBookingFee * $this->event->organiser->tax_value)/100; } else { $this->taxAmount = 0; } $this->grandTotal = $this->orderTotalWithBookingFee + $this->taxAmount; } /** * @param bool $currencyFormatted * @return float|string */ public function getOrderTotalWithBookingFee($currencyFormatted = false) { if ($currencyFormatted == false ) { return number_format($this->orderTotalWithBookingFee, 2, '.', ''); } return money($this->orderTotalWithBookingFee, $this->event->currency); } /** * @param bool $currencyFormatted * @return float|string */ public function getTaxAmount($currencyFormatted = false) { if ($currencyFormatted == false ) { return number_format($this->taxAmount, 2, '.', ''); } return money($this->taxAmount, $this->event->currency); } /** * @param bool $currencyFormatted * @return float|string */ public function getGrandTotal($currencyFormatted = false) { if ($currencyFormatted == false ) { return number_format($this->grandTotal, 2, '.', ''); } return money($this->grandTotal, $this->event->currency); } /** * @return string */ public function getVatFormattedInBrackets() { return "(+" . $this->getTaxAmount(true) . " " . $this->event->organiser->tax_name . ")"; } } ```
/content/code_sandbox/app/Services/Order.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
634
```php <?php namespace Services\Captcha; /** * Class CaptchaFactory * @package App\Services\Captcha */ class Factory { /** * @param $name * @param $captchaConfig * @return HCaptcha|ReCaptcha * @throws \Exception */ public static function create($captchaConfig) { $name = $captchaConfig["captcha_type"]; switch ($name) { case HCaptcha::CAPTCHA_NAME : { return new HCaptcha($captchaConfig); } case ReCaptcha::CAPTCHA_NAME : { return new ReCaptcha($captchaConfig); } default : { throw New \Exception('Invalid captcha type specified'); } } } } ```
/content/code_sandbox/app/Services/Captcha/Factory.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
163
```php <?php use App\Models\Currency; use Illuminate\Database\Seeder; class CurrencySeeder extends Seeder { /** * @return void */ public function run() { $currencies = [ [ 'id' => 1, 'title' => 'U.S. Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'USD', 'decimal_place' => 2, 'value' => 1.00000000, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 2, 'title' => 'Euro', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'EUR', 'decimal_place' => 2, 'value' => 0.74970001, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 3, 'title' => 'Pound Sterling', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'GBP', 'decimal_place' => 2, 'value' => 0.62220001, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 4, 'title' => 'Australian Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'AUD', 'decimal_place' => 2, 'value' => 0.94790000, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 5, 'title' => 'Canadian Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'CAD', 'decimal_place' => 2, 'value' => 0.98500001, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 6, 'title' => 'Czech Koruna', 'symbol_left' => '', 'symbol_right' => 'K ', 'code' => 'CZK', 'decimal_place' => 2, 'value' => 19.16900063, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 7, 'title' => 'Danish Krone', 'symbol_left' => 'kr ', 'symbol_right' => '', 'code' => 'DKK', 'decimal_place' => 2, 'value' => 5.59420013, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 8, 'title' => 'Hong Kong Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'HKD', 'decimal_place' => 2, 'value' => 7.75290012, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 9, 'title' => 'Hungarian Forint', 'symbol_left' => 'Ft ', 'symbol_right' => '', 'code' => 'HUF', 'decimal_place' => 2, 'value' => 221.27000427, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 10, 'title' => 'Israeli New Sheqel', 'symbol_left' => '?', 'symbol_right' => '', 'code' => 'ILS', 'decimal_place' => 2, 'value' => 3.73559999, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 11, 'title' => 'Japanese Yen', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'JPY', 'decimal_place' => 2, 'value' => 88.76499939, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 12, 'title' => 'Mexican Peso', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'MXN', 'decimal_place' => 2, 'value' => 12.63899994, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 13, 'title' => 'Norwegian Krone', 'symbol_left' => 'kr ', 'symbol_right' => '', 'code' => 'NOK', 'decimal_place' => 2, 'value' => 5.52229977, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 14, 'title' => 'New Zealand Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'NZD', 'decimal_place' => 2, 'value' => 1.18970001, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 15, 'title' => 'Philippine Peso', 'symbol_left' => 'Php ', 'symbol_right' => '', 'code' => 'PHP', 'decimal_place' => 2, 'value' => 40.58000183, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 16, 'title' => 'Polish Zloty', 'symbol_left' => '', 'symbol_right' => 'z', 'code' => 'PLN', 'decimal_place' => 2, 'value' => 3.08590007, 'decimal_point' => ',', 'thousand_point' => '.', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 17, 'title' => 'Singapore Dollar', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'SGD', 'decimal_place' => 2, 'value' => 1.22560000, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 18, 'title' => 'Swedish Krona', 'symbol_left' => 'kr ', 'symbol_right' => '', 'code' => 'SEK', 'decimal_place' => 2, 'value' => 6.45870018, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 19, 'title' => 'Swiss Franc', 'symbol_left' => 'CHF ', 'symbol_right' => '', 'code' => 'CHF', 'decimal_place' => 2, 'value' => 0.92259997, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 20, 'title' => 'Taiwan New Dollar', 'symbol_left' => 'NT$', 'symbol_right' => '', 'code' => 'TWD', 'decimal_place' => 2, 'value' => 28.95199966, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 21, 'title' => 'Thai Baht', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'THB', 'decimal_place' => 2, 'value' => 30.09499931, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2013-11-29 19:51:38', 'updated_at' => '2013-11-29 19:51:38', ], [ 'id' => 22, 'title' => 'Ukrainian hryvnia', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'UAH', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 23, 'title' => 'Icelandic krna', 'symbol_left' => 'kr ', 'symbol_right' => '', 'code' => 'ISK', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 24, 'title' => 'Croatian kuna', 'symbol_left' => 'kn ', 'symbol_right' => '', 'code' => 'HRK', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 25, 'title' => 'Romanian leu', 'symbol_left' => 'lei ', 'symbol_right' => '', 'code' => 'RON', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 26, 'title' => 'Bulgarian lev', 'symbol_left' => '.', 'symbol_right' => '', 'code' => 'BGN', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 27, 'title' => 'Turkish lira', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'TRY', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 28, 'title' => 'Chilean peso', 'symbol_left' => '$', 'symbol_right' => '', 'code' => 'CLP', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 29, 'title' => 'South African rand', 'symbol_left' => 'R', 'symbol_right' => '', 'code' => 'ZAR', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 30, 'title' => 'Brazilian real', 'symbol_left' => 'R$', 'symbol_right' => '', 'code' => 'BRL', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 31, 'title' => 'Malaysian ringgit', 'symbol_left' => 'RM ', 'symbol_right' => '', 'code' => 'MYR', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 32, 'title' => 'Russian ruble', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'RUB', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 33, 'title' => 'Indonesian rupiah', 'symbol_left' => 'Rp ', 'symbol_right' => '', 'code' => 'IDR', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 34, 'title' => 'Indian rupee', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'INR', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 35, 'title' => 'Korean won', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'KRW', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], [ 'id' => 36, 'title' => 'Renminbi', 'symbol_left' => '', 'symbol_right' => '', 'code' => 'CNY', 'decimal_place' => 2, 'value' => 0.00, 'decimal_point' => '.', 'thousand_point' => ',', 'status' => 1, 'created_at' => '2015-07-22 23:25:30', 'updated_at' => '2015-07-22 23:25:30', ], ]; collect($currencies)->map(function($currency) { factory(Currency::class)->create($currency); }); } } ```
/content/code_sandbox/database/seeds/CurrencySeeder.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
4,824
```php <?php namespace Services\Captcha; use Illuminate\Http\Request; class ReCaptcha { CONST CAPTCHA_NAME = 'recaptcha'; /** * @var array */ public $config; /** * @var string */ public $recaptcha; /** * @var string */ public $ip; /** * ReCaptcha constructor * @param $config */ public function __construct($config) { $this->config = $config; } /** * Determine if request was submitted by a human * * @param $request * @return bool */ public function isHuman(Request $request) { $this->recaptcha = $request->get('g-recaptcha-response'); $this->ip = $request->ip(); if (!empty($this->config['captcha_secret'])) { try { $client = new \GuzzleHttp\Client(); $response = $client->request('POST', 'path_to_url [ 'form_params' => [ 'secret' => $this->config['captcha_secret'], 'response' => $this->recaptcha, 'remoteip' => $this->ip ] ]); $responseData = json_decode($response->getBody()); \Log::debug([$responseData]); return $responseData->success; } catch (\Exception $e) { \Log::debug([$e->getMessage()]); return false; } } \Log::debug("Captcha config missing"); return false; } } ```
/content/code_sandbox/app/Services/Captcha/ReCaptcha.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
342
```php <?php namespace Services\PaymentGateway; use Omnipay\Omnipay; /** * The intention of this factory is to create a service that is a wrapper around the relative Omnipay implementation * Each Gateway is a facade around the Omnipay implementation. Each Class can then handle the nuances. Additionally * having a factory should make it easier to implement any Omnipay Gateway * * Class GatewayFactory * @package App\Services\PaymentGateway */ class Factory { /** * @param $name * @param $paymentGatewayConfig * @return Dummy|Stripe|StripeSCA * @throws \Exception */ public function create($name, $paymentGatewayConfig) { switch ($name) { case Dummy::GATEWAY_NAME : { $gateway = Omnipay::create($name); $gateway->initialize(); return new Dummy($gateway, $paymentGatewayConfig); } case Stripe::GATEWAY_NAME : { $gateway = Omnipay::create($name); $gateway->initialize($paymentGatewayConfig); return new Stripe($gateway, $paymentGatewayConfig); } case StripeSCA::GATEWAY_NAME : { $gateway = Omnipay::create($name); $gateway->initialize($paymentGatewayConfig); return new StripeSCA($gateway, $paymentGatewayConfig); } default : { throw New \Exception('Invalid gateway specified'); } } } } ```
/content/code_sandbox/app/Services/PaymentGateway/Factory.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
317
```php <?php namespace Services\PaymentGateway; class Stripe { CONST GATEWAY_NAME = 'Stripe'; private $transaction_data; private $gateway; private $extra_params = ['stripeToken']; public function __construct($gateway) { $this->gateway = $gateway; $this->options = []; } private function createTransactionData($order_total, $order_email, $event) { $this->transaction_data = [ 'amount' => $order_total, 'currency' => $event->currency->code, 'description' => 'Order for customer: ' . $order_email, 'token' => $this->options['stripeToken'], 'receipt_email' => $order_email ]; return $this->transaction_data; } public function startTransaction($order_total, $order_email, $event) { $this->createTransactionData($order_total, $order_email, $event); $transaction = $this->gateway->purchase($this->transaction_data); $response = $transaction->send(); return $response; } public function getTransactionData() { return $this->transaction_data; } public function extractRequestParameters($request) { foreach ($this->extra_params as $param) { if (!empty($request->get($param))) { $this->options[$param] = $request->get($param); } } } public function completeTransaction($data) {} public function getAdditionalData(){} public function storeAdditionalData() { return false; } public function refundTransaction($order, $refund_amount, $refund_application_fee) { $request = $this->gateway->refund([ 'transactionReference' => $order->transaction_id, 'amount' => $refund_amount, 'refundApplicationFee' => $refund_application_fee ]); $response = $request->send(); if ($response->isSuccessful()) { $refundResponse['successful'] = true; } else { $refundResponse['successful'] = false; $refundResponse['error_message'] = $response->getMessage(); } return $refundResponse; } } ```
/content/code_sandbox/app/Services/PaymentGateway/Stripe.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
479
```php <?php namespace Services\Captcha; use Illuminate\Http\Request; class HCaptcha { CONST CAPTCHA_NAME = 'hcaptcha'; /** * @var array */ public $config; /** * @var string */ public $hcaptcha; /** * @var string */ public $ip; /** * HCaptcha constructor * @param $config */ public function __construct($config) { $this->config = $config; } /** * Determine if request was submitted by a human * * @param $request * @return bool */ public function isHuman(Request $request) { $this->hcaptcha = $request->get('h-captcha-response'); $this->ip = $request->ip(); if (!empty($this->config['captcha_secret'])) { try { $client = new \GuzzleHttp\Client(); $response = $client->request('POST', 'path_to_url [ 'form_params' => [ 'secret' => $this->config['captcha_secret'], 'response' => $this->hcaptcha, 'remoteip' => $this->ip ] ]); $responseData = json_decode($response->getBody()); \Log::debug([$responseData]); return $responseData->success; } catch (\Exception $e) { \Log::debug([$e->getMessage()]); return false; } } \Log::debug("Captcha config missing"); return false; } } ```
/content/code_sandbox/app/Services/Captcha/HCaptcha.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
340
```php <?php namespace Services\PaymentGateway; class StripeSCA { CONST GATEWAY_NAME = 'Stripe\PaymentIntents'; private $transaction_data; private $gateway; private $extra_params = ['paymentMethod', 'payment_intent']; public function __construct($gateway) { $this->gateway = $gateway; $this->options = []; } private function createTransactionData($order_total, $order_email, $event) { $returnUrl = route('showEventCheckoutPaymentReturn', [ 'event_id' => $event->id, 'is_payment_successful' => 1, ]); $this->transaction_data = [ 'amount' => $order_total, 'currency' => $event->currency->code, 'description' => 'Order for customer: ' . $order_email, 'paymentMethod' => $this->options['paymentMethod'], 'receipt_email' => $order_email, 'returnUrl' => $returnUrl, 'confirm' => true ]; return $this->transaction_data; } public function startTransaction($order_total, $order_email, $event) { $this->createTransactionData($order_total, $order_email, $event); $response = $this->gateway->authorize($this->transaction_data)->send(); return $response; } public function getTransactionData() { return $this->transaction_data; } public function extractRequestParameters($request) { foreach ($this->extra_params as $param) { if (!empty($request->get($param))) { $this->options[$param] = $request->get($param); } } } public function completeTransaction($data) { if (array_key_exists('payment_intent', $data)) { $intentData = [ 'paymentIntentReference' => $data['payment_intent'], ]; } else { $intentData = [ 'paymentIntentReference' => $this->options['payment_intent'], ]; } $paymentIntent = $this->gateway->fetchPaymentIntent($intentData); $response = $paymentIntent->send(); if ($response->requiresConfirmation()) { $confirmResponse = $this->gateway->confirm($intentData)->send(); if ($confirmResponse->isSuccessful()) { $response = $this->gateway->capture($intentData)->send(); } } else { $response = $this->gateway->capture($intentData)->send(); } return $response; } public function getAdditionalData($response) { $additionalData['payment_intent'] = $response->getPaymentIntentReference(); return $additionalData; } public function storeAdditionalData() { return true; } public function refundTransaction($order, $refund_amount, $refund_application_fee) { $request = $this->gateway->refund([ 'transactionReference' => $order->transaction_id, 'amount' => $refund_amount, 'refundApplicationFee' => $refund_application_fee ]); $response = $request->send(); if ($response->isSuccessful()) { $refundResponse['successful'] = true; } else { $refundResponse['successful'] = false; $refundResponse['error_message'] = $response->getMessage(); } return $refundResponse; } } ```
/content/code_sandbox/app/Services/PaymentGateway/StripeSCA.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
741
```php <?php namespace App\Mail; use App\Models\Attendee; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendOrderAttendeeTicketMail extends Mailable { use Queueable, SerializesModels; /** * The Attendee instance. * * @var Attendee */ public $attendee; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct(Attendee $attendee) { $this->attendee = $attendee; $this->email_logo = $attendee->event->organiser->full_logo_path; } /** * Build the message. * * @return $this */ public function build() { $file_name = $this->attendee->getReferenceAttribute(); $file_path = public_path(config('attendize.event_pdf_tickets_path')) . '/' . $file_name . '.pdf'; $subject = trans( "Controllers.tickets_for_event", ["event" => $this->attendee->event->title] ); return $this->subject($subject) ->attach($file_path) ->view('Emails.OrderAttendeeTicket'); } } ```
/content/code_sandbox/app/Mail/SendOrderAttendeeTicketMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
283
```php <?php namespace App\Mail; use App\Models\Attendee; use App\Models\Event; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendMessageToAttendeesMail extends Mailable { use Queueable, SerializesModels; public $subject; public $content; public $event; public $attendee; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct($subject, $content, Event $event, Attendee $attendee) { $this->subject = $subject; $this->content = $content; $this->event = $event; $this->attendee = $attendee; $this->email_logo = $event->organiser->full_logo_path; } /** * Build the message. * * @return $this */ public function build() { return $this->subject($this->subject) ->from(config('attendize.outgoing_email_noreply'), $this->event->organiser->name) ->replyTo($this->event->organiser->email, $this->event->organiser->name) ->view('Emails.MessageToAttendees'); } } ```
/content/code_sandbox/app/Mail/SendMessageToAttendeesMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
295
```php <?php namespace Services\PaymentGateway; class Dummy { CONST GATEWAY_NAME = 'Dummy'; private $transaction_data; private $gateway; public function __construct($gateway) { $this->gateway = $gateway; $this->options = []; } private function createTransactionData($order_total, $order_email, $event) { $token = uniqid(); $this->transaction_data = [ 'amount' => $order_total, 'currency' => $event->currency->code, 'description' => 'Order for customer: ' . $order_email, 'card' => config('attendize.fake_card_data'), 'token' => $token, 'receipt_email' => $order_email ]; return $this->transaction_data; } public function startTransaction($order_total, $order_email, $event) { $this->createTransactionData($order_total, $order_email, $event); $transaction = $this->gateway->purchase($this->transaction_data); $response = $transaction->send(); return $response; } public function getTransactionData() { return $this->transaction_data; } public function extractRequestParameters($request) {} public function completeTransaction($data) {} public function getAdditionalData() {} public function storeAdditionalData() { return false; } public function refundTransaction($order, $refund_amount, $refund_application_fee) { $request = $this->gateway->refund([ 'transactionReference' => $order->transaction_id, 'amount' => $refund_amount, 'refundApplicationFee' => $refund_application_fee ]); $response = $request->send(); if ($response->isSuccessful()) { $refundResponse['successful'] = true; } else { $refundResponse['successful'] = false; $refundResponse['error_message'] = $response->getMessage(); } return $refundResponse; } } ```
/content/code_sandbox/app/Services/PaymentGateway/Dummy.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
436
```php <?php namespace App\Mail; use App\Models\Order; use App\Services\Order as OrderService; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendOrderConfirmationMail extends Mailable { use Queueable, SerializesModels; /** * The order instance. * * @var Order */ public $order; /** * The order service instance. * * @var OrderService */ public $orderService; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct(Order $order, OrderService $orderService) { $this->email_logo = $order->event->organiser->full_logo_path; $this->order = $order; $this->orderService = $orderService; } /** * Build the message. * * @return $this */ public function build() { $file_name = $this->order->order_reference; $file_path = public_path(config('attendize.event_pdf_tickets_path')) . '/' . $file_name . '.pdf'; $subject = trans( "Controllers.tickets_for_event", ["event" => $this->order->event->title] ); return $this->subject($subject) ->attach($file_path) ->view('Emails.OrderConfirmation'); } } ```
/content/code_sandbox/app/Mail/SendOrderConfirmationMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
317
```php <?php namespace App\Mail; use App\Models\Attendee; use App\Models\Event; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendMessageToAttendeeMail extends Mailable { use Queueable, SerializesModels; public $subject; public $content; public $event; public $attendee; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct($subject, $content, Event $event, Attendee $attendee) { $this->subject = $subject; $this->content = $content; $this->event = $event; $this->attendee = $attendee; $this->email_logo = $event->organiser->full_logo_path; } /** * Build the message. * * @return $this */ public function build() { return $this->subject($this->subject) ->from(config('attendize.outgoing_email_noreply'), $this->event->organiser->name) ->replyTo($this->event->organiser->email, $this->event->organiser->name) ->view('Emails.MessageToAttendees'); } } ```
/content/code_sandbox/app/Mail/SendMessageToAttendeeMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
295
```php <?php namespace App\Mail; use App\Models\Order; use App\Services\Order as OrderService; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; class SendOrderNotificationMail extends Mailable { use Queueable, SerializesModels; /** * The order instance. * * @var Order */ public $order; /** * The order service instance. * * @var OrderService */ public $orderService; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct(Order $order, OrderService $orderService) { $this->order = $order; $this->orderService = $orderService; $this->email_logo = $order->event->organiser->full_logo_path; } /** * Build the message. * * @return $this */ public function build() { $subject = trans("Controllers.new_order_received", ["event" => $this->order->event->title, "order" => $this->order->order_reference]); return $this->subject($subject) ->view('Emails.OrderNotification'); } } ```
/content/code_sandbox/app/Mail/SendOrderNotificationMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
277
```php <?php namespace App\Mail; use App\Models\Attendee; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Log; class SendAttendeeInviteMail extends Mailable { use Queueable, SerializesModels; public $attendee; public $email_logo; /** * Create a new message instance. * * @return void */ public function __construct(Attendee $attendee) { $this->attendee = $attendee; $this->email_logo = $attendee->event->organiser->full_logo_path; } /** * Build the message. * * @return $this */ public function build() { Log::debug("Sending invite to: " . $this->attendee->email); $subject = trans("Email.your_ticket_for_event", ["event" => $this->attendee->order->event->title]); $file_name = $this->attendee->getReferenceAttribute(); $file_path = public_path(config('attendize.event_pdf_tickets_path')) . '/' . $file_name . '.pdf'; return $this->subject($subject) ->attach($file_path) ->view('Emails.AttendeeInvite'); } } ```
/content/code_sandbox/app/Mail/SendAttendeeInviteMail.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
290
```php <?php namespace App\Attendize; use Auth; use PhpSpec\Exception\Exception; class Utils { /** * Check if the current user is registered * * @return bool */ public static function isRegistered() { return Auth::check() && Auth::user()->is_registered; } /** * Check if the current user is confirmed * * @return bool */ public static function isConfirmed() { return Auth::check() && Auth::user()->is_confirmed; } /** * Check if the DB has been set up * * @return bool */ public static function isDatabaseSetup() { try { if (Schema::hasTable('accounts')) { return true; } } catch (\Exception $e) { return false; } } /** * Are we the cloud version of attendize or in dev enviornment? * * @return bool */ public static function isAttendize() { return self::isAttendizeCloud() || self::isAttendizeDev(); } /** * Are we the cloud version of Attendize? * * @return bool */ public static function isAttendizeCloud() { return isset($_ENV['ATTENDIZE_CLOUD']) && $_ENV['ATTENDIZE_CLOUD'] == 'true'; } /** * Are we in a dev enviornment? * * @return bool */ public static function isAttendizeDev() { return isset($_ENV['ATTENDIZE_DEV']) && $_ENV['ATTENDIZE_DEV'] == 'true'; } public static function isDownForMaintenance() { return file_exists(storage_path() . '/framework/down'); } /** * Check if a user has admin access to events etc. * * @todo - This is a temp fix until user roles etc. are implemented * @param $object * @return bool */ public static function userOwns($object) { if (!Auth::check()) { return false; } try { if (Auth::user()->account_id === $object->account_id) { return true; } } catch (Exception $e) { return false; } return false; } /** * Determine max upload size * * @return float|int */ public static function file_upload_max_size() { static $max_size = -1; if ($max_size < 0) { // Start with post_max_size. $max_size = self::parse_size(ini_get('post_max_size')); // If upload_max_size is less, then reduce. Except if upload_max_size is // zero, which indicates no limit. $upload_max = self::parse_size(ini_get('upload_max_filesize')); if ($upload_max > 0 && $upload_max < $max_size) { $max_size = $upload_max; } } return $max_size; } /** * Parses the given size * * @param $size * @return float */ public static function parse_size($size) { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); // Remove the non-unit characters from the size. $size = preg_replace('/[^0-9\.]/', '', $size); // Remove the non-numeric characters from the size. if ($unit) { // Find the position of the unit in the ordered string which is the power of magnitude to multiply a kilobyte by. return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); } else { return round($size); } } /** * Check if Attendize is installed * * @return bool */ public static function installed(): bool { return file_exists(base_path('installed')); } /** * Safely parse a version number from a string * * @return string */ public static function parse_version($string): string { if (preg_match('/(\d+\.?\d+\.?\d+)/', $string, $matches) === 1) { return $matches[0]; } return ''; } } ```
/content/code_sandbox/app/Attendize/Utils.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
964
```php <?php namespace App\Attendize; /** * Class Payment * * Payment functions and utilities * * @package App\Attendize */ class PaymentUtils { /** * The inverse of isFree function * * @param int $amount Amount of money to check * * @return bool true if requires payment, false if not */ public static function requiresPayment($amount) { return !self::isFree($amount); } /** * Verify if a certain amount is free or not * * @param int $amount Amount of money to check * * @return bool true if is free, false if not */ public static function isFree($amount) { return ceil($amount) <= 0; } } ```
/content/code_sandbox/app/Attendize/PaymentUtils.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
181
```php <?php namespace App\Exports; use App\Models\Order; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromQuery; use DB; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Events\BeforeExport; class OrdersExport implements FromQuery, WithHeadings, WithEvents { use Exportable; public function __construct(int $event_id) { $this->event_id = $event_id; } /** * @return \Illuminate\Support\Query */ public function query() { $yes = strtoupper(trans("basic.yes")); $no = strtoupper(trans("basic.no")); $query = Order::query()->where('event_id', $this->event_id); $query->select([ 'orders.first_name', 'orders.last_name', 'orders.email', 'orders.order_reference', 'orders.amount', DB::raw("(CASE WHEN orders.is_refunded = 1 THEN '$yes' ELSE '$no' END) AS `orders.is_refunded`"), DB::raw("(CASE WHEN orders.is_partially_refunded = 1 THEN '$yes' ELSE '$no' END) AS `orders.is_partially_refunded`"), 'orders.amount_refunded', 'orders.created_at', ]); return $query; } public function headings(): array { return [ trans("Attendee.first_name"), trans("Attendee.last_name"), trans("Attendee.email"), trans("Order.order_ref"), trans("Order.amount"), trans("Order.fully_refunded"), trans("Order.partially_refunded"), trans("Order.amount_refunded"), trans("Order.order_date"), ]; } /** * @return array */ public function registerEvents(): array { return [ BeforeExport::class => function(BeforeExport $event) { $event->writer->getProperties()->setCreator(config('attendize.app_name')); $event->writer->getProperties()->setCompany(config('attendize.app_name')); }, ]; } } ```
/content/code_sandbox/app/Exports/OrdersExport.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
474
```php <?php namespace App\Exports; use App\Models\Attendee; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromQuery; use Auth; use DB; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Events\BeforeExport; class AttendeesExport implements FromQuery, WithHeadings, WithEvents { use Exportable; public function __construct(int $event_id) { $this->event_id = $event_id; } /** * @return \Illuminate\Support\Query */ public function query() { $yes = strtoupper(trans("basic.yes")); $no = strtoupper(trans("basic.no")); $query = Attendee::query()->select([ 'attendees.first_name', 'attendees.last_name', 'attendees.email', 'attendees.private_reference_number', 'orders.order_reference', 'tickets.title', 'orders.created_at', DB::raw("(CASE WHEN attendees.has_arrived THEN '$yes' ELSE '$no' END) AS has_arrived"), 'attendees.arrival_time', ])->join('events', 'events.id', '=', 'attendees.event_id') ->join('orders', 'orders.id', '=', 'attendees.order_id') ->join('tickets', 'tickets.id', '=', 'attendees.ticket_id') ->where('attendees.event_id', $this->event_id) ->where('attendees.account_id', Auth::user()->account_id) ->where('attendees.is_cancelled', false); return $query; } public function headings(): array { return [ trans("Attendee.first_name"), trans("Attendee.last_name"), trans("Attendee.email"), trans("Ticket.id"), trans("Order.order_ref"), trans("Ticket.ticket_type"), trans("Order.order_date"), trans("Attendee.has_arrived"), trans("Attendee.arrival_time"), ]; } /** * @return array */ public function registerEvents(): array { return [ BeforeExport::class => function(BeforeExport $event) { $event->writer->getProperties()->setCreator(config('attendize.app_name')); $event->writer->getProperties()->setCompany(config('attendize.app_name')); }, ]; } } ```
/content/code_sandbox/app/Exports/AttendeesExport.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
527
```php <?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ Commands\Install::class, Commands\CreateDatabase::class, ]; /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); } } ```
/content/code_sandbox/app/Console/Kernel.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
170
```php <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; class UserResetPassword extends Notification { use Queueable; private $token; /** * UserResetPassword constructor. * @param $token */ public function __construct($token) { $this->token = $token; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { $mailMessage = new MailMessage(); $mailMessage->view('Emails.Auth.Reminder', ['token' => $this->token]); return ($mailMessage) ->line('The introduction to the notification.') ->action('Notification Action', url('/')) ->line('Thank you for using our application!'); } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ // ]; } } ```
/content/code_sandbox/app/Notifications/UserResetPassword.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
316
```php <?php namespace App\Console\Commands; use Illuminate\Console\Command; use DB; class CreateDatabase extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'make:database {db_name}'; /** * The console command description. * * @var string */ protected $description = 'Create a new database'; /** * Execute the console command. * * @return mixed */ public function handle() { DB::statement('CREATE DATABASE IF NOT EXISTS '.$this->argument('db_name').";"); } } ```
/content/code_sandbox/app/Console/Commands/CreateDatabase.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
141
```php <?php namespace App\Rules; use Illuminate\Contracts\Validation\Rule; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class Passcheck implements Rule { /** * Create a new rule instance. * * @return void */ public function __construct() { // } /** * Determine if the validation rule passes. * * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { return Hash::check($value, Auth::user()->getAuthPassword()); } /** * Get the validation error message. * * @return string */ public function message() { return trans('Controllers.error.password.passcheck'); } } ```
/content/code_sandbox/app/Rules/Passcheck.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
179
```php <?php namespace App\Imports; use App\Models\Event; use App\Models\EventStats; use App\Models\Attendee; use App\Models\Order; use App\Models\OrderItem; use App\Models\Ticket; use Auth; use Maatwebsite\Excel\Concerns\Importable; use Maatwebsite\Excel\Concerns\ToModel; use Maatwebsite\Excel\Concerns\WithHeadingRow; use App\Jobs\SendAttendeeInviteJob; use Maatwebsite\Excel\Row; use Maatwebsite\Excel\Concerns\OnEachRow; class AttendeesImport implements OnEachRow, WithHeadingRow { use Importable; public function __construct(Event $event, Ticket $ticket, bool $emailAttendees) { $this->event = $event; $this->ticket = $ticket; $this->emailAttendees = $emailAttendees; } /** * @param array $row * * @return \Illuminate\Database\Eloquent\Model|null */ public function onRow(Row $row) { $rowArr = $row->toArray(); $firstName = $rowArr['first_name']; $lastName = $rowArr['last_name']; $email = $rowArr['email']; \Log::info(sprintf("Importing attendee: %s (%s %s)", $email, $firstName, $lastName)); // Create a new order for the attendee $order = Order::create([ 'first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'order_status_id' => config('attendize.order.complete'), 'amount' => 0, 'account_id' => Auth::user()->account_id, 'event_id' => $this->event->id, 'taxamt' => 0, ]); $orderItem = OrderItem::create([ 'title' => $this->ticket->title, 'quantity' => 1, 'order_id' => $order->id, 'unit_price' => 0, ]); // Increment the ticket quantity $this->ticket->increment('quantity_sold'); (new EventStats())->updateTicketsSoldCount($this->event->id, 1); $attendee = Attendee::create([ 'first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'event_id' => $this->event->id, 'order_id' => $order->id, 'ticket_id' => $this->ticket->id, 'account_id' => Auth::user()->account_id, 'reference_index' => 1, ]); if ($this->emailAttendees) { SendAttendeeInviteJob::dispatch($attendee); } return $attendee; } } ```
/content/code_sandbox/app/Imports/AttendeesImport.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
623
```php <?php if (!function_exists('money')) { /** * Format a given amount to the given currency * * @param $amount * @param \App\Models\Currency $currency * @return string */ function money($amount, \App\Models\Currency $currency) { return $currency->symbol_left . number_format($amount, $currency->decimal_place, $currency->decimal_point, $currency->thousand_point) . $currency->symbol_right; } } ```
/content/code_sandbox/app/Helpers/helpers.php
php
2016-03-03T01:33:10
2024-08-16T12:05:02
Attendize
Attendize/Attendize
3,955
113