Skip to content

Commit

Permalink
feat: updated table columns,renamed form-component, implemented form …
Browse files Browse the repository at this point in the history
…logic close #15, close #23
  • Loading branch information
stevan06v committed Jan 23, 2024
1 parent f4e3d93 commit 5352678
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 83 deletions.
59 changes: 0 additions & 59 deletions .env.example

This file was deleted.

36 changes: 36 additions & 0 deletions app/Livewire/JoinProjectForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Livewire;

use App\Models\Project;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Livewire\Component;

class JoinProjectForm extends Component
{
public $projectUrl;

public function save(){
if(Auth::check()) {
$projectHash = Hash::make($this->projectUrl, [
'memory' => 516,
'time' => 2,
'threads' => 2,
]);

Project::create([
"project_url" => $this->projectUrl,
"project_hash" => $projectHash,
"user_id" => Auth::user()->id
]);
}else{
$this->redirect('/register');
}
}

public function render()
{
return view('livewire.join-project-form');
}
}
15 changes: 0 additions & 15 deletions app/Livewire/SubmitIdForm.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Project extends Model

protected $fillable = [
"project_url",
"project_identification",
"project_hash",
"user_id"
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function up(): void
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('project_url');
$table->string('project_identification');
$table->string('project_hash');
$table->timestamps();
});
}
Expand Down
6 changes: 6 additions & 0 deletions resources/views/livewire/join-project-form.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<form wire:submit="save" class="flex items-baseline gap-2">
<sl-input class="w-11/12" type="text" id="url" value="https://github.com/propromo-software" placeholder="url" filled wire:model="projectUrl"></sl-input>
<sl-button class="" wire:click="save">submit</sl-button>
</form>
</div>
6 changes: 0 additions & 6 deletions resources/views/livewire/submit-id-form.blade.php

This file was deleted.

2 changes: 1 addition & 1 deletion resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@
</div>
@endif

<livewire:submit-id-form />
<livewire:join-project-form />
</div>
</body>

Expand Down

0 comments on commit 5352678

Please sign in to comment.