I am doing a simple paste that I have done many times without any problems, and for some odd reason, it does not work, and I get this error message:
error: {type: "ErrorException", message: "Array to string conversion",…}
file: "C:\wamp\www\studentreg2\vendor\laravel\framework\src\Illuminate\Database\Grammar.php"
line: 33
message: "Array to string conversion"
type: "ErrorException"
Here is my code:
$advisorCheck = AdvisorCheck::create([
'status' => Input::get('status'),
'application_id' => Input::get('id'),
'user_id' => Auth::id()
]);
The migration for the advisor_check table used for the AdvisorCheck model seems to be fine, all foreign keys are unsigned and correctly show relationships in phpmyadmin, all values from the Input :: get line are strings, the model has the correct fields specified as fillable (status, application_id, user_id )
I even tried to do this in the php artisan tinkerfollowing way:
AdvisorCheck::create([ 'status' => 'returned', 'application_id' => '3', 'user_id' => '4']);
and I get this answer: Converting an array to a string
I also tried this method and got the same error:
$advisorCheck = new AdvisorCheck;
$advisorCheck->status = Input::get('status');
$advisorCheck->application_id = Input::get('id');
$advisorCheck->user_id = Auth::id();
$advisorCheck->save();
Model Code:
<?php
class AdvisorCheck extends \Eloquent {
protected $fillable = ['status', 'application_id', 'user_id'];
protected $table = ['advisor_check'];
}
If you need to see more code, please ask.
, !