add validation to import

This commit is contained in:
hackerESQ
2024-08-27 22:49:01 -05:00
parent 5e4b30e516
commit 1ee6a5c17b
2 changed files with 15 additions and 11 deletions
+11 -11
View File
@@ -82,17 +82,6 @@
<x-ib-card title="{{ __('Fundamentals') }}" class="md:col-span-4">
<p>
<span class="font-bold">{{ __('52 week') }}: </span>
<x-fifty-two-week-range
:low="$market_data->fifty_two_week_low"
:high="$market_data->fifty_two_week_high"
:current="$market_data->market_value"
/>
</p>
<p>
<span class="font-bold">{{ __('Forward PE') }}: </span>
{{ $market_data->forward_pe }}
@@ -108,6 +97,17 @@
${{ Number::forHumans($market_data->market_cap ?? 0) }}
</p>
<p>
<span class="font-bold">{{ __('52 week') }}: </span>
<x-fifty-two-week-range
:low="$market_data->fifty_two_week_low"
:high="$market_data->fifty_two_week_high"
:current="$market_data->market_value"
/>
</p>
</x-ib-card>
<x-ib-card title="{{ __('Recent activity') }}" class="md:col-span-3">
@@ -4,18 +4,22 @@ use Livewire\WithFileUploads;
use Livewire\Volt\Component;
use Mary\Traits\Toast;
use App\Imports\BackupImport;
use Livewire\Attributes\Rule;
new class extends Component {
use Toast;
use WithFileUploads;
// props
#[Rule('required|file|mimes:xlsx|max:2048')]
public $file;
// methods
public function import()
{
$this->validate();
$import = (new BackupImport)->import($this->file);
$this->success(__('Successfully imported!'));