You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

<?php
namespace App\Livewire;
use App\Models\airflow;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
class AirflowForm extends Component
{
public $name;
public $url;
public $username;
public $password;
public $api_token;
public $port;
public $version;
public function submit()
{
$this->validate([
'name' => 'required|string|max:255',
'url' => 'required|url',
'username' => 'required|string|max:255',
'password' => 'required|string|max:255',
'api_token' => 'nullable|string|max:255',
'port' => 'required|integer',
'version' => 'nullable|string|max:255',
]);
Airflow::create([
'name' => $this->name,
'url' => $this->url,
'username' => $this->username,
'password' => $this->password,
'api_token' => $this->api_token,
'port' => $this->port,
'version' => $this->version,
'user_id' => Auth::user()->id,
]);
session()->flash('message', 'Airflow cluster created successfully.');
}
public function render()
{
return view('livewire.airflow-form');
}
}