@@ -2,7 +2,7 @@ discard block  | 
                                                    ||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Support\Str;  | 
                                                        
| 4 | 4 | |
| 5 | -if (! function_exists('unique_random')) { | 
                                                        |
| 5 | +if (!function_exists('unique_random')) { | 
                                                        |
| 6 | 6 | /**  | 
                                                        
| 7 | 7 | * Generate a unique random string of characters  | 
                                                        
| 8 | 8 | * uses str_random() helper for generating the random string.  | 
                                                        
@@ -47,13 +47,13 @@ discard block  | 
                                                    ||
| 47 | 47 | // If unique is still false at this point  | 
                                                        
| 48 | 48 | // it will just repeat all the steps until  | 
                                                        
| 49 | 49 | // it has generated a random string of characters  | 
                                                        
| 50 | - } while (! $unique);  | 
                                                        |
| 50 | + } while (!$unique);  | 
                                                        |
| 51 | 51 | |
| 52 | 52 | return $random;  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | -if (! function_exists('readCSV')) { | 
                                                        |
| 56 | +if (!function_exists('readCSV')) { | 
                                                        |
| 57 | 57 | function readCSV($filename = '', $delimiter = ',')  | 
                                                        
| 58 | 58 |      { | 
                                                        
| 59 | 59 | // Read the file  | 
                                                        
@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | }  | 
                                                        
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
| 73 | -if (! function_exists('writeCSV')) { | 
                                                        |
| 73 | +if (!function_exists('writeCSV')) { | 
                                                        |
| 74 | 74 | function writeCSV($filename = '', $data = [])  | 
                                                        
| 75 | 75 |      { | 
                                                        
| 76 | 76 | $file = fopen($filename, 'w');  | 
                                                        
@@ -43,19 +43,19 @@ discard block  | 
                                                    ||
| 43 | 43 |          foreach ($dnas as $dna) { | 
                                                        
| 44 | 44 |  //            system('/usr/bin/python3 /home/genealogia/public_html/dna.py ' . $this->var_name . ' ' . $dna->variable_name . ' ' . '/home/genealogia/public_html/storage/app/dna/'. $this->file_name . ' ' . '/home/genealogia/public_html/storage/app/dna/'. $dna->file_name); | 
                                                        
| 45 | 45 |              chdir('/var/www/api.familytree365.com/app'); | 
                                                        
| 46 | -            exec('python3 dna.py '.$this->var_name.' '.$dna->variable_name.' '.$this->file_name.' '.$dna->file_name); | 
                                                        |
| 46 | +            exec('python3 dna.py ' . $this->var_name . ' ' . $dna->variable_name . ' ' . $this->file_name . ' ' . $dna->file_name); | 
                                                        |
| 47 | 47 | $dm = new DM();  | 
                                                        
| 48 | 48 | $dm->user_id = $user->id;  | 
                                                        
| 49 | - $dm->image = 'shared_dna_'.$this->var_name.'_'.$dna->variable_name.'.png';  | 
                                                        |
| 50 | - $dm->file1 = 'discordant_snps_'.$this->var_name.'_'.$dna->variable_name.'_GRCh37.csv';  | 
                                                        |
| 51 | - $dm->file2 = 'shared_dna_one_chrom_'.$this->var_name.'_'.$dna->variable_name.'_GRCh37.csv';  | 
                                                        |
| 49 | + $dm->image = 'shared_dna_' . $this->var_name . '_' . $dna->variable_name . '.png';  | 
                                                        |
| 50 | + $dm->file1 = 'discordant_snps_' . $this->var_name . '_' . $dna->variable_name . '_GRCh37.csv';  | 
                                                        |
| 51 | + $dm->file2 = 'shared_dna_one_chrom_' . $this->var_name . '_' . $dna->variable_name . '_GRCh37.csv';  | 
                                                        |
| 52 | 52 | $dm->save();  | 
                                                        
| 53 | 53 | |
| 54 | -            $data = readCSV(storage_path('app'.DIRECTORY_SEPARATOR.'dna'.DIRECTORY_SEPARATOR.'output'.DIRECTORY_SEPARATOR.$dm->file1), ','); | 
                                                        |
| 54 | +            $data = readCSV(storage_path('app' . DIRECTORY_SEPARATOR . 'dna' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $dm->file1), ','); | 
                                                        |
| 55 | 55 | array_shift($data);  | 
                                                        
| 56 | -            $data = writeCSV(storage_path('app'.DIRECTORY_SEPARATOR.'dna'.DIRECTORY_SEPARATOR.'output'.DIRECTORY_SEPARATOR.$dm->file1), $data); | 
                                                        |
| 56 | +            $data = writeCSV(storage_path('app' . DIRECTORY_SEPARATOR . 'dna' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $dm->file1), $data); | 
                                                        |
| 57 | 57 | |
| 58 | -            $data = readCSV(storage_path('app'.DIRECTORY_SEPARATOR.'dna'.DIRECTORY_SEPARATOR.'output'.DIRECTORY_SEPARATOR.$dm->file2), ','); | 
                                                        |
| 58 | +            $data = readCSV(storage_path('app' . DIRECTORY_SEPARATOR . 'dna' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $dm->file2), ','); | 
                                                        |
| 59 | 59 | array_shift($data);  | 
                                                        
| 60 | 60 | |
| 61 | 61 | $temp_data = $data;  | 
                                                        
@@ -74,7 +74,7 @@ discard block  | 
                                                    ||
| 74 | 74 | $dm->largest_cm_segment = round($largest_cm, 2);  | 
                                                        
| 75 | 75 | $dm->save();  | 
                                                        
| 76 | 76 | |
| 77 | -            $data = writeCSV(storage_path('app'.DIRECTORY_SEPARATOR.'dna'.DIRECTORY_SEPARATOR.'output'.DIRECTORY_SEPARATOR.$dm->file2), $data); | 
                                                        |
| 77 | +            $data = writeCSV(storage_path('app' . DIRECTORY_SEPARATOR . 'dna' . DIRECTORY_SEPARATOR . 'output' . DIRECTORY_SEPARATOR . $dm->file2), $data); | 
                                                        |
| 78 | 78 | }  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | }  | 
                                                        
@@ -20,8 +20,8 @@ discard block  | 
                                                    ||
| 20 | 20 |          if ($request->has('searchTerm')) { | 
                                                        
| 21 | 21 | $columnsToSearch = ['group', 'titl', 'obje_id', 'rin'];  | 
                                                        
| 22 | 22 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 23 | -            if (! empty($search_term)) { | 
                                                        |
| 24 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 23 | +            if (!empty($search_term)) { | 
                                                        |
| 24 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 25 | 25 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 26 | 26 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 27 | 27 | }  | 
                                                        
@@ -32,8 +32,8 @@ discard block  | 
                                                    ||
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 33 | 33 | |
| 34 | 34 |              foreach ($filters as $key => $value) { | 
                                                        
| 35 | -                if (! empty($value)) { | 
                                                        |
| 36 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 35 | +                if (!empty($value)) { | 
                                                        |
| 36 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
| 39 | 39 | }  | 
                                                        
@@ -21,8 +21,8 @@ discard block  | 
                                                    ||
| 21 | 21 |          if ($request->has('searchTerm')) { | 
                                                        
| 22 | 22 | $columnsToSearch = ['description', 'is_active', 'husband_id', 'wife_id', 'type_id', 'chan', 'nchi', 'rin'];  | 
                                                        
| 23 | 23 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 24 | -            if (! empty($search_term)) { | 
                                                        |
| 25 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 24 | +            if (!empty($search_term)) { | 
                                                        |
| 25 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 26 | 26 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 27 | 27 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 28 | 28 | }  | 
                                                        
@@ -33,8 +33,8 @@ discard block  | 
                                                    ||
| 33 | 33 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 34 | 34 | |
| 35 | 35 |              foreach ($filters as $key => $value) { | 
                                                        
| 36 | -                if (! empty($value)) { | 
                                                        |
| 37 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 36 | +                if (!empty($value)) { | 
                                                        |
| 37 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 38 | 38 | }  | 
                                                        
| 39 | 39 | }  | 
                                                        
| 40 | 40 | }  | 
                                                        
@@ -47,7 +47,7 @@ discard block  | 
                                                    ||
| 47 | 47 |          if ($request->has('perPage')) { | 
                                                        
| 48 | 48 | $rows = $query->paginate($request->perPage);  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | -        if (! count($request->all())) { | 
                                                        |
| 50 | +        if (!count($request->all())) { | 
                                                        |
| 51 | 51 | $rows = $query->get();  | 
                                                        
| 52 | 52 | }  | 
                                                        
| 53 | 53 | |
@@ -19,8 +19,8 @@ discard block  | 
                                                    ||
| 19 | 19 |          if ($request->has('searchTerm')) { | 
                                                        
| 20 | 20 | $columnsToSearch = ['group', 'date', 'text', 'agnc'];  | 
                                                        
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 22 | -            if (! empty($search_term)) { | 
                                                        |
| 23 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 22 | +            if (!empty($search_term)) { | 
                                                        |
| 23 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 24 | 24 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 26 | 26 | }  | 
                                                        
@@ -31,8 +31,8 @@ discard block  | 
                                                    ||
| 31 | 31 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 32 | 32 | |
| 33 | 33 |              foreach ($filters as $key => $value) { | 
                                                        
| 34 | -                if (! empty($value)) { | 
                                                        |
| 35 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 34 | +                if (!empty($value)) { | 
                                                        |
| 35 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -19,8 +19,8 @@ discard block  | 
                                                    ||
| 19 | 19 |          if ($request->has('searchTerm')) { | 
                                                        
| 20 | 20 | $columnsToSearch = ['group', 'even', 'role'];  | 
                                                        
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 22 | -            if (! empty($search_term)) { | 
                                                        |
| 23 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 22 | +            if (!empty($search_term)) { | 
                                                        |
| 23 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 24 | 24 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 26 | 26 | }  | 
                                                        
@@ -31,8 +31,8 @@ discard block  | 
                                                    ||
| 31 | 31 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 32 | 32 | |
| 33 | 33 |              foreach ($filters as $key => $value) { | 
                                                        
| 34 | -                if (! empty($value)) { | 
                                                        |
| 35 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 34 | +                if (!empty($value)) { | 
                                                        |
| 35 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -19,8 +19,8 @@ discard block  | 
                                                    ||
| 19 | 19 |          if ($request->has('searchTerm')) { | 
                                                        
| 20 | 20 | $columnsToSearch = ['name', 'email', 'phone'];  | 
                                                        
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 22 | -            if (! empty($search_term)) { | 
                                                        |
| 23 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 22 | +            if (!empty($search_term)) { | 
                                                        |
| 23 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 24 | 24 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 26 | 26 | }  | 
                                                        
@@ -31,8 +31,8 @@ discard block  | 
                                                    ||
| 31 | 31 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 32 | 32 | |
| 33 | 33 |              foreach ($filters as $key => $value) { | 
                                                        
| 34 | -                if (! empty($value)) { | 
                                                        |
| 35 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 34 | +                if (!empty($value)) { | 
                                                        |
| 35 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -19,8 +19,8 @@ discard block  | 
                                                    ||
| 19 | 19 |          if ($request->has('searchTerm')) { | 
                                                        
| 20 | 20 | $columnsToSearch = ['group', 'refn', 'type'];  | 
                                                        
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 22 | -            if (! empty($search_term)) { | 
                                                        |
| 23 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 22 | +            if (!empty($search_term)) { | 
                                                        |
| 23 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 24 | 24 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 26 | 26 | }  | 
                                                        
@@ -31,8 +31,8 @@ discard block  | 
                                                    ||
| 31 | 31 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 32 | 32 | |
| 33 | 33 |              foreach ($filters as $key => $value) { | 
                                                        
| 34 | -                if (! empty($value)) { | 
                                                        |
| 35 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 34 | +                if (!empty($value)) { | 
                                                        |
| 35 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -19,8 +19,8 @@ discard block  | 
                                                    ||
| 19 | 19 |          if ($request->has('searchTerm')) { | 
                                                        
| 20 | 20 | $columnsToSearch = ['group', 'subm'];  | 
                                                        
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm;  | 
                                                        
| 22 | -            if (! empty($search_term)) { | 
                                                        |
| 23 | - $searchQuery = '%'.$search_term.'%';  | 
                                                        |
| 22 | +            if (!empty($search_term)) { | 
                                                        |
| 23 | + $searchQuery = '%' . $search_term . '%';  | 
                                                        |
| 24 | 24 |                  foreach ($columnsToSearch as $column) { | 
                                                        
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery);  | 
                                                        
| 26 | 26 | }  | 
                                                        
@@ -31,8 +31,8 @@ discard block  | 
                                                    ||
| 31 | 31 | $filters = get_object_vars(json_decode($request->columnFilters));  | 
                                                        
| 32 | 32 | |
| 33 | 33 |              foreach ($filters as $key => $value) { | 
                                                        
| 34 | -                if (! empty($value)) { | 
                                                        |
| 35 | - $query->orWhere($key, 'like', '%'.$value.'%');  | 
                                                        |
| 34 | +                if (!empty($value)) { | 
                                                        |
| 35 | + $query->orWhere($key, 'like', '%' . $value . '%');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  |