public function testItPurgesSingleFavorite() { $user = $this->user(); $log = $this->logs($user); $this->actingAs($user)->visit('favorites')->see("Instead")->press("redownload-{$log->id}")->seePageIs('/favorites')->dontSee($log->imgur_id); $log = Log::whereId($log->id)->withTrashed()->first(); $this->assertTrue($log->trashed()); }
/** * Purge / delete a single Favorite * @param PurgeFavoriteRequest $request * @param Log $log * @return redirect */ public function purge(PurgeFavoriteRequest $request, Log $log) { $log->delete(); return redirect()->back()->withSuccess("Log for Favorite deleted."); }
/** * Create new entry in logs table * @param object $object * @return ImguBox\Log */ private function createLog($object) { $isAlbum = false; if (property_exists($object, 'is_album')) { $isAlbum = $object->is_album; } return Log::create(['user_id' => $this->user->id, 'imgur_id' => $object->id, 'is_album' => $isAlbum]); }