Compare commits
5 Commits
3096af9c7a
...
3d657ecfd8
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d657ecfd8 | |||
| b28e53d333 | |||
| d8b5904ef5 | |||
| 9bdf500359 | |||
| 4375975002 |
@@ -0,0 +1,79 @@
|
||||
<?php namespace GermanAirlinesVa\Fleet\Classes;
|
||||
|
||||
use GermanAirlinesVa\Fleet\Models\Aircraft as Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use GraphQL\Type\Definition\ResolveInfo;
|
||||
use Nuwave\Lighthouse\Subscriptions\Subscriber;
|
||||
use Nuwave\Lighthouse\Schema\Types\GraphQLSubscription;
|
||||
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
|
||||
|
||||
class Aircraft extends GraphQLSubscription
|
||||
{
|
||||
/**
|
||||
* Check if subscriber is allowed to listen to the subscription.
|
||||
*
|
||||
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(Subscriber $subscriber, Request $request): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter which subscribers should receive the subscription.
|
||||
*
|
||||
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
|
||||
* @param mixed $root
|
||||
* @return bool
|
||||
*/
|
||||
public function filter(Subscriber $subscriber, $root): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode topic name.
|
||||
*
|
||||
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
|
||||
* @param string $fieldName
|
||||
* @return string
|
||||
*/
|
||||
public function encodeTopic(Subscriber $subscriber, string $fieldName): string
|
||||
{
|
||||
// Create a unique topic name based on the `author` argument
|
||||
return Str::snake($fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode topic name.
|
||||
*
|
||||
* @param string $fieldName
|
||||
* @param \App\Post $root
|
||||
* @return string
|
||||
*/
|
||||
public function decodeTopic(string $fieldName, $root): string
|
||||
{
|
||||
return Str::snake($fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the subscription.
|
||||
*
|
||||
* @param \App\Post $root
|
||||
* @param array<string, mixed> $args
|
||||
* @param \Nuwave\Lighthouse\Support\Contracts\GraphQLContext $context
|
||||
* @param \GraphQL\Type\Definition\ResolveInfo $resolveInfo
|
||||
* @return mixed
|
||||
*/
|
||||
public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): Model
|
||||
{
|
||||
// Optionally manipulate the `$root` item before it gets broadcasted to
|
||||
// subscribed client(s).
|
||||
$root->load();
|
||||
|
||||
return $root;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "germanairlinesva/fleet",
|
||||
"type": "october-plugin",
|
||||
"description": "None",
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ columns:
|
||||
type: text
|
||||
in_use:
|
||||
label: in_use
|
||||
type: text
|
||||
type: switch
|
||||
total_miles:
|
||||
label: total_miles
|
||||
type: text
|
||||
|
||||
@@ -14,7 +14,7 @@ columns:
|
||||
valueFrom: name
|
||||
only_charter:
|
||||
label: only_charter
|
||||
type: text
|
||||
type: switch
|
||||
type:
|
||||
label: type
|
||||
type: text
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php namespace GermanAirlinesVa\Fleet\Updates;
|
||||
|
||||
use Config;
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateGermanAirlinesVaFleetDeferredBindings extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection('germanairlinesva_fleet')->create('deferred_bindings', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->increments('id')->unsigned();
|
||||
$table->string('master_type');
|
||||
$table->string('master_field');
|
||||
$table->string('slave_type');
|
||||
$table->integer('slave_id');
|
||||
$table->mediumText('pivot_data')->nullable();
|
||||
$table->string('session_key');
|
||||
$table->boolean('is_bind')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection('germanairlinesva_fleet')->disableForeignKeyConstraints();
|
||||
Schema::connection('germanairlinesva_fleet')->dropIfExists('deferred_bindings');
|
||||
Schema::connection('germanairlinesva_fleet')->enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
1.0.1:
|
||||
- 'Initialize plugin.'
|
||||
- 'Create table deferred_bindings'
|
||||
- builder_table_create_deferred_bindings.php
|
||||
1.0.2:
|
||||
- 'Created table aircraft_manufacturers'
|
||||
- builder_table_create_aircraft_manufacturers.php
|
||||
|
||||
Reference in New Issue
Block a user