public function testTimeRestrictionsAreSerialized() { $activity = FactoryMuffin::create('DMA\\Friends\\Models\\Activity'); $timeRestrictionData = ['start_time' => '11:00AM', 'end_time' => '12:00PM', 'days' => [1 => true, 2 => false, 3 => true, 4 => false, 5 => true, 6 => false]]; $activity->time_restriction_data = $timeRestrictionData; $activity->save(); // Load a new reference to the model $newActivity = Activity::find($activity->id); // Compare time_restriction_data to ensure that attributes are serialized/unserialized properly $this->assertEquals($newActivity->time_restriction_data, $timeRestrictionData); }
public function afterSave() { $activity = Activity::find($this->getKey()); $activity->touch(); }
public function onUndoHide() { // Get submit data $activity_id = (int) post('activity'); // Validate $activity = Activity::find($activity_id); if ($activity) { // Get User $user = Auth::getUser(); Rating::where('activity_id', $activity_id)->where('user_id', $user->id)->delete(); Flash::success('Okay. That activity will be available in your recommendations now.'); } else { Flash::error('That activity does not exist.'); } // return flash message return ['#flashMessages' => $this->renderPartial('@flashMessages')]; }