Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AsksToRebuildSite
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 askToRebuildSite
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3namespace Hyde\Framework\Concerns\Commands;
4
5use Illuminate\Support\Facades\Artisan;
6
7/**
8 * Used in Commands to ask the user if they want to rebuild the site, and if so, rebuild it.
9 */
10trait AsksToRebuildSite
11{
12    protected function askToRebuildSite(): void
13    {
14        if ($this->option('no-interaction')) {
15            return;
16        }
17
18        if ($this->confirm('Would you like to rebuild the site?', 'Yes')) {
19            $this->line('Okay, building site!');
20            Artisan::call('build');
21            $this->info('Site is built!');
22        } else {
23            $this->line('Okay, you can always run the build later!');
24        }
25    }
26}