src/Label305/AujaLaravel/Config/AujaConfigurator.php
private function findManyToManyRelations(array $models) {
        //$this->app['log']->debug('Finding many to many relations');
        for ($i = 0; $i < sizeof($models); $i++) {
            for ($j = $i + 1; $j < sizeof($models); $j++) {
                $model1 = $models[$i];
                $model2 = $models[$j];

                /* We assume names of pivot tables are alphabetically ordered */
                if (strcasecmp($model1->getName(), $model2->getName()) < 0) {
                    $tableName = strtolower($model1->getName()) . '_' . strtolower($model2->getName());
                } else {
                    $tableName = strtolower($model2->getName()) . '_' . strtolower($model1->getName());
                }

                if ($this->databaseRepository->hasTable($tableName)) {
                    $this->defineManyToManyRelation($model1, $model2);
                }
            }
        }
    }
private function findManyToManyRelations(array $models) {
        //$this->app['log']->debug('Finding many to many relations');
        for ($i = 0; $i < sizeof($models); $i++) {
            for ($j = $i + 1; $j < sizeof($models); $j++) {
                $model1 = $models[$i];
                $model2 = $models[$j];

                /* We assume names of pivot tables are alphabetically ordered */
                if (strcasecmp($model1->getName(), $model2->getName()) < 0) {
                    $tableName = strtolower($model1->getName()) . '_' . strtolower($model2->getName());
                } else {
                    $tableName = strtolower($model2->getName()) . '_' . strtolower($model1->getName());
                }

                if ($this->databaseRepository->hasTable($tableName)) {
                    $this->defineManyToManyRelation($model1, $model2);
                }
            }
        }
    }
Finds and defines many to many relations between models in given array.

@param $models Model[] the model names to look for relations for.