first commit
This commit is contained in:
22
app/Livewire/Actions/Logout.php
Normal file
22
app/Livewire/Actions/Logout.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Actions;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class Logout
|
||||
{
|
||||
/**
|
||||
* Log the current user out of the application.
|
||||
*/
|
||||
public function __invoke()
|
||||
{
|
||||
Auth::guard('web')->logout();
|
||||
|
||||
Session::invalidate();
|
||||
Session::regenerateToken();
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
13
app/Livewire/ApprovalWorkflow.php
Normal file
13
app/Livewire/ApprovalWorkflow.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class ApprovalWorkflow extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.approval-workflow');
|
||||
}
|
||||
}
|
||||
13
app/Livewire/CommentSystem.php
Normal file
13
app/Livewire/CommentSystem.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class CommentSystem extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.comment-system');
|
||||
}
|
||||
}
|
||||
13
app/Livewire/DocumentBrowser.php
Normal file
13
app/Livewire/DocumentBrowser.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class DocumentBrowser extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.document-browser');
|
||||
}
|
||||
}
|
||||
55
app/Livewire/Folder/CreateModal.php
Normal file
55
app/Livewire/Folder/CreateModal.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Folder;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Folder;
|
||||
|
||||
class CreateModal extends Component
|
||||
{
|
||||
|
||||
public $project;
|
||||
public $parentFolder;
|
||||
public $folderName = '';
|
||||
public $showModal = false;
|
||||
|
||||
protected $listeners = [
|
||||
'openCreateFolderModal' => 'openForRoot',
|
||||
'openCreateSubfolderModal' => 'openForParent'
|
||||
];
|
||||
|
||||
public function openForRoot($projectId)
|
||||
{
|
||||
$this->project = Project::find($projectId);
|
||||
$this->parentFolder = null;
|
||||
$this->showModal = true;
|
||||
}
|
||||
|
||||
public function openForParent($parentFolderId)
|
||||
{
|
||||
$this->parentFolder = Folder::find($parentFolderId);
|
||||
$this->project = $this->parentFolder->project;
|
||||
$this->showModal = true;
|
||||
}
|
||||
|
||||
public function createFolder()
|
||||
{
|
||||
$this->validate([
|
||||
'folderName' => 'required|max:255|unique:folders,name'
|
||||
]);
|
||||
|
||||
Folder::create([
|
||||
'name' => $this->folderName,
|
||||
'project_id' => $this->project->id,
|
||||
'parent_id' => $this->parentFolder?->id
|
||||
]);
|
||||
|
||||
$this->reset(['folderName', 'showModal']);
|
||||
$this->emit('folderCreated');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.folder.create-modal');
|
||||
}
|
||||
}
|
||||
50
app/Livewire/ProjectShow.php
Normal file
50
app/Livewire/ProjectShow.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Project;
|
||||
use App\Models\Folder;
|
||||
use App\Models\Document;
|
||||
|
||||
class ProjectShow extends Component
|
||||
{
|
||||
|
||||
public Project $project;
|
||||
public $selectedFolderId = null;
|
||||
public $expandedFolders = [];
|
||||
|
||||
public function mount(Project $project)
|
||||
{
|
||||
$this->project = $project->load('rootFolders');
|
||||
}
|
||||
|
||||
public function selectFolder($folderId)
|
||||
{
|
||||
$this->selectedFolderId = $folderId;
|
||||
}
|
||||
|
||||
public function toggleFolder($folderId)
|
||||
{
|
||||
if (in_array($folderId, $this->expandedFolders)) {
|
||||
$this->expandedFolders = array_diff($this->expandedFolders, [$folderId]);
|
||||
} else {
|
||||
$this->expandedFolders[] = $folderId;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDocumentsProperty()
|
||||
{
|
||||
return Document::where('folder_id', $this->selectedFolderId)
|
||||
->where('project_id', $this->project->id)
|
||||
->with('versions')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project-show', [
|
||||
'rootFolders' => $this->project->rootFolders
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user