Esempio n. 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroyClient()
 {
     $clientToDelete = $_POST['clientID'];
     $clients = Clients::destroy($clientToDelete);
     //Delete Twitter details
     //Check if model exists in SocialMediaVault
     if (DB::table('social_media_vaults')->where('clientID', $clientToDelete)->count() >= 1) {
         DB::table('social_media_vaults')->where('clientID', $clientToDelete)->delete();
     }
     if (DB::table('twitterOAuth')->where('clientID', $clientToDelete)->count() >= 1) {
         DB::table('twitterOAuth')->where('clientID', $clientToDelete)->delete();
     }
     if (DB::table('posts')->where('clientID', $clientToDelete)->count() >= 1) {
         DB::table('posts')->where('clientID', $clientToDelete)->delete();
     }
 }
 public function destroy($id)
 {
     Clients::destroy($id);
     return redirect('clients');
 }