Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function up() |
||
14 | { |
||
15 | Schema::create('promocodes', function (Blueprint $table) { |
||
16 | $table->increments('id'); |
||
17 | |||
18 | $table->string('code', 32)->unique(); |
||
19 | $table->double('reward', 10, 2)->nullable(); |
||
20 | $table->integer('quantity')->nullable(); |
||
21 | |||
22 | $table->text('data')->nullable(); |
||
23 | |||
24 | $table->boolean('is_disposable')->default(false); |
||
25 | $table->timestamp('expires_at')->nullable(); |
||
26 | }); |
||
27 | |||
28 | Schema::create('promocode_user', function (Blueprint $table) { |
||
29 | $table->increments('id'); |
||
30 | |||
31 | $table->unsignedBigInteger('user_id'); |
||
32 | $table->unsignedBigInteger('promocode_id'); |
||
33 | |||
34 | $table->timestamp('used_at'); |
||
35 | |||
36 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); |
||
|
|||
37 | $table->foreign('promocode_id')->references('id')->on('promocodes')->onDelete('cascade'); |
||
38 | }); |
||
39 | } |
||
40 | |||
52 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: