Trying to set a column as a dateTime type, and to default as the current time and date. However, I keep getting the Error mentioned in the title...
This issue in question is related to the 'dateAccepted' field, the 'dateSubmitted' will probably also have this issue too, but I havent attempted that yet.
Am I using the wrong data type? or just coded wrong..? All advice welcome. (P.S new to the site, apologies for formatting)
public function up()
{
Schema::create('adoption_requests', function (Blueprint $table) {
$table->increments('id');
$table->bigInteger('userid')->unsigned();
$table->bigInteger('animalID')->unsigned();
$table->date('dateSubmitted');
$table->dateTime('dateAccepted')->default(getdate())->nullable();
$table->date('requestAccepted');
$table->date('staffID');
$table->timestamps();
//$table->boolean('$adoptionStatus')->default(0);
$table->foreign('userid')->references('id')->on('users');
$table->foreign('animalID')->references('id')->on('animals');
});
}
ErrorException : Array to string conversion
at C:\xampp\htdocs\AAS\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php:248
244| }
245|
246| return is_bool($value)
247| ? "'".(int) $value."'"
> 248| : "'".(string) $value."'";
249| }
250|
251| /**
252| * Create an empty Doctrine DBAL TableDiff from the Blueprint.
Exception trace:
1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Array to string conversion", "C:\xampp\htdocs\AAS\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php", [])
C:\xampp\htdocs\AAS\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\Grammar.php:248
2 Illuminate\Database\Schema\Grammars\Grammar::getDefaultValue()
C:\xampp\htdocs\AAS\vendor\laravel\framework\src\Illuminate\Database\Schema\Grammars\MySqlGrammar.php:946
Please use the argument -v to see more details.