예제 #1
0
 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());
 }
예제 #2
0
 /**
  * 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.");
 }
예제 #3
0
 /**
  * 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]);
 }