| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 17 | public function execute($request)  | 
            ||
| 18 |     { | 
            ||
| 19 | $source = app($request['source'])->getTable();  | 
            ||
| 20 | $target = app($request['target'])->getTable();  | 
            ||
| 21 | $foreignKey = $this->getForeignKey($request);  | 
            ||
| 22 | $stub = __DIR__ . '/../../../resources/stubs/migration/relation.stub';  | 
            ||
| 23 | $this->filename = 'database/migrations/'  | 
            ||
| 24 |             . date('Y_m_d_His') | 
            ||
| 25 |             . "_create_{$source}_{$target}_relation.php"; | 
            ||
| 26 | |||
| 27 | File::put(base_path($this->filename), str_replace([  | 
            ||
| 28 | '$source$',  | 
            ||
| 29 | '$target$',  | 
            ||
| 30 | '$classname$',  | 
            ||
| 31 | '$column$',  | 
            ||
| 32 | '$foreignKey$'  | 
            ||
| 33 | ], [  | 
            ||
| 34 | $source,  | 
            ||
| 35 | $target,  | 
            ||
| 36 | 'Create' . ucfirst(Str::camel($source)) . ucfirst(Str::camel($target)) . 'Relation',  | 
            ||
| 37 |             "\$table->foreign('$foreignKey')->references('{$this->getLocalKey($request)}')->on('$target');", | 
            ||
| 38 | $foreignKey  | 
            ||
| 39 | ], File::get($stub)));  | 
            ||
| 40 | }  | 
            ||
| 41 | }  | 
            ||
| 42 |