modularsoftware /
genealogy
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Jobs; |
||||
| 4 | |||||
| 5 | use Auth; |
||||
| 6 | use File; |
||||
| 7 | use Illuminate\Bus\Queueable; |
||||
| 8 | use Illuminate\Contracts\Queue\ShouldQueue; |
||||
| 9 | use Illuminate\Foundation\Bus\Dispatchable; |
||||
| 10 | use Illuminate\Http\Request; |
||||
| 11 | use Illuminate\Queue\InteractsWithQueue; |
||||
| 12 | use Illuminate\Queue\SerializesModels; |
||||
| 13 | use ModularSoftware\LaravelGedcom\Utils\GedcomGenerator; |
||||
| 14 | |||||
| 15 | class ExportGedCom implements ShouldQueue |
||||
| 16 | { |
||||
| 17 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 18 | |||||
| 19 | protected $family_id; |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Create a new job instance. |
||||
| 23 | * |
||||
| 24 | * @return void |
||||
| 25 | */ |
||||
| 26 | public function __construct($family_id, Request $request) |
||||
|
0 ignored issues
–
show
The parameter
$request is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 27 | { |
||||
| 28 | // |
||||
| 29 | $this->family_id = $family_id; |
||||
| 30 | } |
||||
| 31 | |||||
| 32 | /** |
||||
| 33 | * Execute the job. |
||||
| 34 | * |
||||
| 35 | * @return void |
||||
| 36 | */ |
||||
| 37 | public function handle() |
||||
| 38 | { |
||||
| 39 | // |
||||
| 40 | $headers = [ |
||||
|
0 ignored issues
–
show
|
|||||
| 41 | 'Content-type' => 'text/txt', |
||||
| 42 | ]; |
||||
| 43 | $p_id = 0; |
||||
| 44 | $f_id = $this->family_id; |
||||
| 45 | $up_nest = 3; |
||||
| 46 | $down_nest = 3; |
||||
| 47 | $writer = new GedcomGenerator($p_id, $f_id, $up_nest, $down_nest); |
||||
| 48 | $content = $writer->getGedcomPerson(); |
||||
| 49 | // $user_id = Auth::user()->id; |
||||
| 50 | $ts = microtime(true); |
||||
| 51 | $file = env('APP_NAME').date('_Ymd_').$ts.'.GED'; |
||||
| 52 | $destinationPath = public_path().'/upload/'; |
||||
| 53 | if (! is_dir($destinationPath)) { |
||||
| 54 | mkdir($destinationPath, 0777, true); |
||||
| 55 | } |
||||
| 56 | File::put($destinationPath.$file, $content); |
||||
| 57 | |||||
| 58 | return 0; |
||||
|
0 ignored issues
–
show
|
|||||
| 59 | } |
||||
| 60 | } |
||||
| 61 |