diff --git a/.gitignore b/.gitignore index 7fe978f..a9d7296 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ yarn-error.log /.fleet /.idea /.vscode + +storage/repositories diff --git a/app/Livewire/CreateRepository.php b/app/Livewire/CreateRepository.php new file mode 100644 index 0000000..64fc8ef --- /dev/null +++ b/app/Livewire/CreateRepository.php @@ -0,0 +1,36 @@ +extends('layouts.app'); + } + + public function create() + { + $this->validate(); + + $repository = new Repository(); + $repository->title = $this->title; + $repository->user_id = Auth::id(); + $repository->save(); + + $git = new Git(); + + $git->init(storage_path('repositories/' . $this->title)); + + $this->redirect(route('home'), navigate: true); + } +} diff --git a/app/Livewire/Repositories.php b/app/Livewire/Repositories.php new file mode 100644 index 0000000..fb0fbf1 --- /dev/null +++ b/app/Livewire/Repositories.php @@ -0,0 +1,26 @@ +extends('layouts.app');; + } + + #[Computed()] + public function repositories() + { + return Repository::all(); + } + + public function create() + { + return $this->redirect(route('repositories.create'), navigate: true); + } +} diff --git a/app/Models/Repository.php b/app/Models/Repository.php new file mode 100644 index 0000000..adb0d20 --- /dev/null +++ b/app/Models/Repository.php @@ -0,0 +1,16 @@ +=5.6.0" + }, + "require-dev": { + "nette/tester": "^2.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jan Pecha", + "email": "janpecha@email.cz" + } + ], + "description": "Library for work with Git repository in PHP.", + "keywords": [ + "git" + ], + "support": { + "issues": "https://github.com/czproject/git-php/issues", + "source": "https://github.com/czproject/git-php/tree/v4.2.0" + }, + "funding": [ + { + "url": "https://www.janpecha.cz/donate/git-php/", + "type": "other" + } + ], + "time": "2023-07-12T09:14:30+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.2", diff --git a/database/migrations/2024_01_13_221907_create_repositories_table.php b/database/migrations/2024_01_13_221907_create_repositories_table.php new file mode 100644 index 0000000..9b4b5db --- /dev/null +++ b/database/migrations/2024_01_13_221907_create_repositories_table.php @@ -0,0 +1,29 @@ +id(); + $table->string('title'); + $table->foreignId('user_id')->constrained(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('repositories'); + } +}; diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 13f68c5..ce25bf8 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -1,9 +1,11 @@ @extends('layouts.base') @section('body') - @yield('content') - - @isset($slot) - {{ $slot }} - @endisset +