Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
43 | public function handle() |
||
44 | { |
||
45 | $storyExists = $this->client->get('spaces/' . config('storyblok.space_id') . '/stories/', [ |
||
46 | 'with_slug' => $this->argument('slug') |
||
47 | ])->getBody()['stories']; |
||
48 | |||
49 | if ($storyExists) { |
||
50 | $filename = 'storyblok-' . Str::of($this->argument('slug'))->replace('/', '-')->slug() . '.json'; |
||
51 | |||
52 | $story = $this->client->get('spaces/' . config('storyblok.space_id') . '/stories/' . $storyExists[0]['id'])->getBody(); |
||
53 | |||
54 | $json = json_encode($story); |
||
55 | |||
56 | Storage::put($filename, $json); |
||
57 | |||
58 | $this->info('Saved to storage: ' . $filename); |
||
59 | } else { |
||
60 | $this->warn('There is no story for your slug: ' . $this->argument('slug')); |
||
61 | } |
||
64 |