Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincrozat committed Oct 16, 2023
1 parent 9692884 commit 7dc7587
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function run() : void

Merchant::factory(10)->create();

// Opening::factory(10)->create();
Opening::factory(10)->create();
}
}
24 changes: 17 additions & 7 deletions resources/views/livewire/pint-express.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
state([
'code' => '',
'error' => '',
'preset' => 'laravel',
'result' => '',
]);
Expand All @@ -22,19 +23,22 @@
$hash = sha1($this->code);
if (! Str::startsWith($this->code, '<?php', '<?')) {
$this->code = "<?php $this->code";
}
$code = ! Str::startsWith($this->code, '<?php', '<?')
? "<?php $this->code"
: $this->code;
File::put($path = sys_get_temp_dir() . "/$hash", $this->code);
File::put($path = sys_get_temp_dir() . "/$hash", $code);
$binary = config('pint-express.php_binary');
$result = Process::path(base_path())
->run("$binary vendor/bin/pint $path --preset $this->preset")
->throw();
->run("$binary vendor/bin/pint $path --preset $this->preset");
$this->result = File::get($path);
if ($result->failed()) {
$this->error = $result->output();
} else {
$this->result = File::get($path);
}
File::delete($path);
};
Expand All @@ -47,6 +51,12 @@
?>

<div>
@if ($error)
<div class="p-4 mb-4 overflow-x-scroll text-red-600 rounded-lg bg-red-50">
{{ $error }}
</div>
@endif

@if ($result)
<div class="text-right">
<x-button
Expand Down

0 comments on commit 7dc7587

Please sign in to comment.