Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR)
Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed in...
Model
class Event extends Model
{
protected $table = 'events';
protected $guarded = [];
protected $fillable = [
'title',
'color',
'start_date',
'end_date'
];
}
Controller
public function create(){
$events = Event::all();
$event = [];
foreach ($events as $event) {
$event[] = \Calendar::event(
$event->title, //event title
true, //full day event?
new \DateTime($event->start_date), //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
new \DateTime($event->end_date), //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg),
$event->id, //optional event ID
[
'color' => $event->color,
]
);
}
// dd($events);
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_RECOVERABLE_ERROR) Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed in...
Model class Event extends Model { protected $table = 'events'; protected $guarded = []; protected $fillable = [ 'title', 'color', 'start_date', 'end_date' ]; }
Controller public function create(){ $events = Event::all(); $event = []; foreach ($events as $event) { $event[] = \Calendar::event( $event->title, //event title true, //full day event? new \DateTime($event->start_date), //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg) new \DateTime($event->end_date), //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg), $event->id, //optional event ID [ 'color' => $event->color, ] ); } // dd($events);
DB Schema::create('events', function (Blueprint $table) { $table->increments('id'); $table->string('title'); $table->string('color'); $table->dateTime('start_date'); $table->dateTime('end_date'); $table->timestamps(); });