-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from lara-zeus/media-library
Media library
- Loading branch information
Showing
21 changed files
with
714 additions
and
150 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class LibraryFactory extends Factory | ||
{ | ||
public function getModel(): string | ||
{ | ||
return config('zeus-sky.models.library'); | ||
} | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'slug' => $this->faker->slug(2), | ||
'title' => $this->faker->word, | ||
'description' => $this->faker->sentence, | ||
'type' => $this->faker->randomElements(config('zeus-sky.library_types')), | ||
'file_path' => 'https://picsum.photos/200/300', | ||
]; | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
database/migrations/2022_07_04_104832_add_indices_to_posts.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('libraries', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('slug'); | ||
$table->text('title'); | ||
$table->text('description')->nullable(); | ||
$table->string('type')->nullable(); | ||
$table->string('file_path')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('libraries'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<div x-data class="space-y-4 my-6 mx-4 "> | ||
|
||
<x-slot name="header"> | ||
<h2>{{ $item->title }}</h2> | ||
</x-slot> | ||
|
||
<x-slot name="breadcrumps"> | ||
<li class="flex items-center"> | ||
<a href="{{ route('library') }}">{{ __('library') }}</a> | ||
<x-iconpark-rightsmall-o class="fill-current w-4 h-4 mx-3" /> | ||
</li> | ||
|
||
<li class="flex items-center"> | ||
Viewing {{ $item->title }} | ||
</li> | ||
</x-slot> | ||
|
||
<x-filament::card> | ||
<h1>{{ $item->title }}</h1> | ||
|
||
<p> | ||
{{ $item->description }} | ||
</p> | ||
|
||
<p class="text-base font-light text-gray-500"> | ||
<span>{{ __('created at') }}</span>: | ||
<span>{{ $item->created_at->format('Y.m/d') }}-{{ $item->created_at->format('h:i a') }}</span> | ||
</p> | ||
|
||
@if($item->type === 'IMAGE') | ||
<img class="mx-auto" src="{{ $item->file_path }}"> | ||
@endif | ||
|
||
@if($item->type === 'FILE') | ||
<div class="text-center"> | ||
<x-filament::button tag="a" target="_blank" href="{{ $item->file_path }}" class="mx-auto"> | ||
{{ __('Show File') }} | ||
</x-filament::button> | ||
</div> | ||
@endif | ||
|
||
@if($item->type === 'VIDEO') | ||
<video width="100%" class="w-full" controls> | ||
<source src="{{ $item->file_path }}"> | ||
Your browser does not support HTML video. | ||
</video> | ||
@endif | ||
|
||
</x-filament::card> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<div class="mx-4"> | ||
|
||
<x-slot name="header"> | ||
<h1>{{ __('Libraries') }}</h1> | ||
</x-slot> | ||
|
||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-2"> | ||
@foreach($categories as $category) | ||
<x-zeus::box> | ||
<h2>{{ $category->name }}</h2> | ||
<div class="space-y-2"> | ||
@foreach($category->library as $library) | ||
<div> | ||
<a href="{{ route('library.item', ['slug' => $library->slug]) }}" class="flex flex-col py-2 px-1.5 hover:bg-gray-100 dark:hover:bg-gray-600 rounded-md transition ease-in-out duration-500 block cursor-pointer"> | ||
<div x-data class="flex items-center justify-between text-primary-600 dark:text-primary-400 hover:dark:text-primary-300"> | ||
<h3>{{ $library->title ?? '' }}</h3> | ||
@if($library->type === 'IMAGE') | ||
<x-heroicon-o-photograph x-tooltip.raw="{{ __('Image') }}" class="w-4 h-4 text-gray-400 dark:text-gray-500" /> | ||
@endif | ||
|
||
@if($library->type === 'FILE') | ||
<x-heroicon-o-document x-tooltip.raw="{{ __('File') }}" class="w-4 h-4 text-gray-400 dark:text-gray-500" /> | ||
@endif | ||
|
||
@if($library->type === 'VIDEO') | ||
<x-heroicon-o-film x-tooltip.raw="{{ __('Video') }}" class="w-4 h-4 text-gray-400 dark:text-gray-500" /> | ||
@endif | ||
</div> | ||
<cite class="text-sm text-secondary-600 dark:text-secondary-500 hover:dark:text-secondary-300"> | ||
{{ $library->description }} | ||
</cite> | ||
</a> | ||
</div> | ||
@endforeach | ||
</div> | ||
</x-zeus::box> | ||
@endforeach | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.