when I run php artisan migrate:refresh
I got error like this
[ErrorException]
Argument 2 passed to Illuminate\Database\Schema\Blueprint::build() must be
an instance of Illuminate\Database\Schema\Grammars\Grammar, null given, cal
led in /Users/adityabudiutomo/Documents/project/web/getboards/vendor/larave
l/framework/src/Illuminate/Database/Schema/Builder.php on line 239 and defi
ned
Here's a patch I used to temporarily fix this
--- vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Schema/Builder.php.orig 2017-02-03 19:08:43.684919355 +0100
+++ vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Schema/Builder.php 2017-02-03 19:08:14.395483413 +0100
@@ -128,6 +128,19 @@
return $blueprint->drop();
}
+ /**
+ * Drop a collection from the schema, if present.
+ *
+ * @param string $collection
+ * @return void
+ */
+ public function dropIfExists($collection)
+ {
+ if ($this->hasCollection($collection)) {
+ $this->drop($collection);
+ }
+ }
+
/**
* Create a new Blueprint.
*
How were you able to connect to the database in the first place. I can't do php artisan migrate. COuld you please help?
@migaliza This doesn't belong here, but - here's some ideas:
use Jenssegers\Mongodb\Schema\Blueprint; in the migration file"can't do php artisan migrate" is really vague, next time please post the actual error you got.
Thank you @MightyPork. Here is the exact error I am getting:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '('
@MightyPork your answer is useful
I've got a similar issue, can't do php artisan migrate and I get the following error:
[MongoDB\Exception\InvalidArgumentException]
$collectionName is invalid:
I'm just doing a simple schema create at the moment, any ideas?
I think it is better to replace dropIfExists with drop in your migrations or implement the dropIfExists logic using drop and hasCollection method like @MightyPork in your migrations.
a year and half later, I'm still using my "temporary" patch. @jenssegers is this closed because it's fixed, or...?
@MightyPork I have the same problem.I replace Schema::dropIfExists() with Schema::drop() , and it works.
Most helpful comment
Here's a patch I used to temporarily fix this