public function run() { DB::table('events')->delete(); $wtc2016 = Event::create(['name' => 'wtc-2016', 'description' => '2016 World Team Championship', 'start_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 9, 24, 9, 30, 0)->timestamp), 'end_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 9, 25, 18, 30, 0)->timestamp)]); $depositDeadline = Deadline::create(['event_id' => $wtc2016->id, 'description' => 'Team deposit (100€)', 'type' => 'payment', 'due_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 4, 1, 23, 59, 59)->timestamp)]); $admin = User::all()->where('name', 'admin')->first(); UserDeadline::create(['user_id' => $admin->id, 'deadline_id' => $depositDeadline->id, 'completed' => false]); }
public function getDueTimestampAttribute() { return Deadline::find($this->deadline_id)->due_timestamp; }