@@ -35,6 +35,13 @@ |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | //TODO: should be place in parent so it can also be used there |
38 | + |
|
39 | + /** |
|
40 | + * @param string $stub |
|
41 | + * @param string $keys |
|
42 | + * @param string $type |
|
43 | + * @param string $pivotModelName |
|
44 | + */ |
|
38 | 45 | private function createRelation($stub, $source, $target, $keys, $methodName, $type, $pivotModelName = null) |
39 | 46 | { |
40 | 47 | $file = (new ReflectionClass($source))->getFileName(); |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Mtolhuys\LaravelSchematics\Actions\Relation; |
4 | 4 | |
5 | -use ReflectionClass; |
|
6 | 5 | use Config; |
6 | +use ReflectionClass; |
|
7 | 7 | |
8 | 8 | use Mtolhuys\LaravelSchematics\Actions\Relation\CreateRelationAction; |
9 | 9 |
@@ -2,19 +2,16 @@ |
||
2 | 2 | |
3 | 3 | namespace Mtolhuys\LaravelSchematics\Http\Controllers; |
4 | 4 | |
5 | -use Mtolhuys\LaravelSchematics\Models\Migration; |
|
6 | -use Mtolhuys\LaravelSchematics\Services\RelationMapper; |
|
7 | -use Mtolhuys\LaravelSchematics\Services\ModelMapper; |
|
8 | 5 | use Illuminate\Contracts\Routing\ResponseFactory; |
9 | -use Symfony\Component\HttpFoundation\Response; |
|
10 | 6 | use Illuminate\Contracts\View\Factory; |
11 | -use Illuminate\Support\Facades\Schema; |
|
12 | -use Illuminate\Support\Facades\Cache; |
|
13 | 7 | use Illuminate\Routing\Controller; |
14 | -use Illuminate\Support\Facades\DB; |
|
8 | +use Illuminate\Support\Facades\Cache; |
|
15 | 9 | use Illuminate\View\View; |
10 | +use Mtolhuys\LaravelSchematics\Models\Migration; |
|
11 | +use Mtolhuys\LaravelSchematics\Services\ModelMapper; |
|
12 | +use Mtolhuys\LaravelSchematics\Services\RelationMapper; |
|
16 | 13 | use ReflectionException; |
17 | -use Config; |
|
14 | +use Symfony\Component\HttpFoundation\Response; |
|
18 | 15 | |
19 | 16 | class SchematicsController extends Controller |
20 | 17 | { |
@@ -11,6 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Find pivot model class for BelongsToMany |
13 | 13 | * |
14 | + * @param \ReflectionMethod $method |
|
14 | 15 | * @return object|null Returns instance of pivot model when found, null on failure |
15 | 16 | */ |
16 | 17 | public static function getPivotModel($method) |
@@ -33,6 +34,8 @@ discard block |
||
33 | 34 | /** |
34 | 35 | * Makes an attemp at finding pivot model class for BelongsToMany without @schematics-pivot tag |
35 | 36 | * |
37 | + * @param \Illuminate\Database\Eloquent\Relations\Relation $invocation |
|
38 | + * @param \ReflectionMethod $method |
|
36 | 39 | * @return object|null Returns instance of pivot model when found, null on failure |
37 | 40 | */ |
38 | 41 | public static function getPivotModelFallback($srcModel, $invocation, $method, $models) |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Mtolhuys\LaravelSchematics\Services; |
4 | 4 | |
5 | -use ReflectionClass; |
|
6 | -use Mtolhuys\LaravelSchematics\Http\Requests\CreateRelationRequest; |
|
7 | 5 | use Mtolhuys\LaravelSchematics\Exceptions\PivotException; |
6 | +use Mtolhuys\LaravelSchematics\Http\Requests\CreateRelationRequest; |
|
7 | +use ReflectionClass; |
|
8 | 8 | |
9 | 9 | class Pivot |
10 | 10 | { |