Browse Source

Update IG Import Controller

Daniel Supernault 6 years ago
parent
commit
77819a6dd0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      app/Http/Controllers/Import/Instagram.php

+ 7 - 0
app/Http/Controllers/Import/Instagram.php

@@ -22,6 +22,13 @@ trait Instagram
 
 
     public function instagramStart(Request $request)
     public function instagramStart(Request $request)
     {	
     {	
+        $completed = ImportJob::whereProfileId(Auth::user()->profile->id)
+            ->whereService('instagram')
+            ->whereNotNull('completed_at')
+            ->exists();
+        if($completed == true) {
+            return redirect(route('settings'))->with(['errors' => ['You can only import from Instagram once.']]);
+        }
     	$job = $this->instagramRedirectOrNew();
     	$job = $this->instagramRedirectOrNew();
     	return redirect($job->url());
     	return redirect($job->url());
     }
     }