welcome page

This commit is contained in:
Benjamin Takats
2022-12-12 14:50:34 +01:00
parent 9405980eca
commit b87dbd7e0d
22 changed files with 323 additions and 104 deletions

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Http\Livewire\Frontend;
use Livewire\Component;
class Welcome extends Component
{
public function render()
{
return view('livewire.frontend.welcome');
}
}

View File

@@ -4,7 +4,6 @@ namespace App\Nova;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Code;
use Laravel\Nova\Fields\HasMany;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\MorphMany;
@@ -47,67 +46,67 @@ class BookCase extends Resource
ID::make()
->sortable(),
Text::make('Title')
Text::make(__('Title'), 'title')
->rules('required', 'string'),
Number::make('Latitude')
Number::make(__('Latitude'), 'latitude')
->rules('required', 'numeric')
->step(0.000001)
->hideFromIndex(),
Number::make('Longitude')
->rules('required', 'numeric')
->step(0.000001)
->hideFromIndex(),
Number::make(__('Longitude'), 'longitude')
->rules('required', 'numeric')
->step(0.000001)
->hideFromIndex(),
Text::make('Address')
Text::make(__('Address'), 'address')
->rules('required', 'string'),
Text::make('Type')
Text::make(__('Type'), 'type')
->rules('required', 'string'),
Text::make('Open')
Text::make(__('Open'), 'open')
->rules('required', 'string')
->hideFromIndex(),
Text::make('Comment')
Text::make(__('Comment'), 'comment')
->rules('required', 'string')
->hideFromIndex(),
Text::make('Contact')
Text::make(__('Contact'), 'contact')
->rules('required', 'string')
->hideFromIndex(),
Text::make('Bcz')
Text::make(__('Bcz'), 'bcz')
->rules('required', 'string')
->hideFromIndex(),
Boolean::make('Digital')
Boolean::make(__('Digital'), 'digital')
->rules('required')
->hideFromIndex(),
Text::make('Icontype')
Text::make(__('Icontype'), 'icontype')
->rules('required', 'string')
->hideFromIndex(),
Boolean::make('Deactivated')
Boolean::make(__('Deactivated'), 'deactivated')
->rules('required'),
Text::make('Deactreason')
Text::make(__('Deactreason'), 'deactreason')
->rules('required', 'string')
->hideFromIndex(),
Text::make('Entrytype')
Text::make(__('Entrytype'), 'entrytype')
->rules('required', 'string')
->hideFromIndex(),
Text::make('Homepage')
Text::make(__('Homepage'), 'homepage')
->rules('required', 'string')
->hideFromIndex(),
HasMany::make('OrangePills'),
HasMany::make(__('OrangePills'), 'orangePills', OrangePill::class),
MorphMany::make('Comments'),
MorphMany::make(__('Comments'), 'comments', Comment::class),
];
}

View File

@@ -2,55 +2,54 @@
namespace App\Nova;
use Laravel\Nova\Fields\ID;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\BelongsToMany;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
class Category extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = \App\Models\Category::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';
public static $title = 'name';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id',
'name',
];
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function fields(Request $request)
{
return [
ID::make()->sortable(),
ID::make()
->sortable(),
Text::make('Name')
Text::make(__('Name'), 'name')
->rules('required', 'string'),
Text::make('Slug')
Text::make(__('Slug'), 'slug')
->rules('required', 'string', 'unique:categories,slug'),
BelongsToMany::make('Courses'),
BelongsToMany::make(__('Courses'), 'courses', Course::class),
];
}
@@ -59,6 +58,7 @@ class Category extends Resource
* Get the cards available for the request.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function cards(Request $request)
@@ -70,6 +70,7 @@ class Category extends Resource
* Get the filters available for the resource.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function filters(Request $request)
@@ -81,6 +82,7 @@ class Category extends Resource
* Get the lenses available for the resource.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function lenses(Request $request)
@@ -92,6 +94,7 @@ class Category extends Resource
* Get the actions available for the resource.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function actions(Request $request)

View File

@@ -44,23 +44,23 @@ class City extends Resource
ID::make()
->sortable(),
Text::make('Name')
Text::make(__('Name'), 'name')
->rules('required', 'string'),
Text::make('Slug')
Text::make(__('Slug'), 'slug')
->exceptOnForms(),
Number::make('Latitude')
Number::make(__('Latitude'), 'latitude')
->rules('required', 'numeric')
->step(0.000001)
->help('<a target="_blank" href="https://www.latlong.net/">https://www.latlong.net/</a>'),
Number::make('Longitude')
Number::make(__('Longitude'), 'longitude')
->rules('required', 'numeric')
->step(0.000001)
->help('<a target="_blank" href="https://www.latlong.net/">https://www.latlong.net/</a>'),
BelongsTo::make('Country'),
BelongsTo::make(__('Country'), 'country', Country::class),
];
}

View File

@@ -20,26 +20,26 @@ class Comment extends Resource
public function fields(NovaRequest $request)
{
return [
Text::make('title', function (CommentModel $comment) {
Text::make(__('Title'), function (CommentModel $comment) {
return $comment->topLevel()->commentable?->commentableName() ?? 'Deleted...';
})->readonly(),
MorphTo::make('Commentator')->types([
MorphTo::make(__('Commentator'), 'commentator')->types([
User::class,
]),
Markdown::make('Original text'),
Markdown::make(__('Original text'), 'original_text'),
Text::make('', function (CommentModel $comment) {
if (! $url = $comment?->commentUrl()) {
return '';
}
return "<a target=\"show_comment\" href=\"{$url}\">Show</a>";
return "<a target=\"show_comment\" href=\"{$url}\">".__('Show')."</a>";
})->asHtml(),
Text::make('status', function(CommentModel $comment) {
Text::make(__('Status'), function(CommentModel $comment) {
if ($comment->isApproved()) {
return "<div class='inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-green-100 text-green-800'>Approved</div>";
}
@@ -47,7 +47,8 @@ class Comment extends Resource
return "<div class='inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800'>Pending</div>";
})->asHtml(),
DateTime::make('Created at'),
DateTime::make(__('Created at'), 'created_at'),
];
}
}

View File

@@ -44,18 +44,18 @@ class Country extends Resource
ID::make()
->sortable(),
Text::make('Name')
Text::make(__('Name'), 'name')
->rules('required', 'string'),
MultiSelect::make('Languages', 'language_codes')
MultiSelect::make(__('Languages'), 'language_codes')
->options(
config('languages.languages'),
),
Text::make('Code')
Text::make(__('Code'), 'code')
->rules('required', 'string'),
HasMany::make('Cities'),
HasMany::make(__('Cities'), 'cities', City::class),
];
}

View File

@@ -59,28 +59,34 @@ class Course extends Resource
ID::make()
->sortable(),
Images::make('Main picture', 'logo')
Images::make(__('Main picture'), 'logo')
->conversionOnIndexView('thumb'),
Images::make('Images', 'images')
// todo: english
Images::make(__('Images'), 'images')
->conversionOnIndexView('thumb')
->help('Lade hier Bilder hoch, um sie eventuell später in der Markdown Description einzufügen. Du musst vorher aber Speichern.'),
->help(__('Lade hier Bilder hoch, um sie eventuell später in der Markdown Description einzufügen. Du musst vorher aber Speichern.')),
Tags::make('Tags')->type('course')->withLinkToTagResource(Tag::class),
Tags::make(__('Tags'))
->type('course')
->withLinkToTagResource(Tag::class),
Text::make('Name')
Text::make(__('Name'), 'name')
->rules('required', 'string'),
Markdown::make('Description')
Markdown::make(__('Description'), 'description')
->alwaysShow()
->help('Markdown ist erlaubt. Du kannst Bilder aus dem Feld "Images" hier einfügen. Benutze das Link Symbol der Bilder für die Urls, nach dem du auf "Aktualisieren und Weiterarbeiten" geklickt hast.'),
->help(__('Markdown ist erlaubt. Du kannst Bilder aus dem Feld "Images" hier einfügen. Benutze das Link Symbol der Bilder für die Urls, nach dem du auf "Aktualisieren und Weiterarbeiten" geklickt hast.')),
BelongsTo::make('Lecturer'),
BelongsTo::make(__('Lecturer'), 'lecturer', Lecturer::class)
->searchable()
->help(__('Wähle hier den Dozenten aus, der den Kurs hält. Wenn der Dozent nicht in der Liste ist, dann erstelle ihn zuerst unter "Dozenten".')),
SelectPlus::make('Categories', 'categories', Category::class)
SelectPlus::make(__('Categories'), 'categories', Category::class)
->usingIndexLabel('name'),
BelongsToMany::make('Categories')->onlyOnDetail(),
BelongsToMany::make(__('Categories'), 'categories', Category::class)
->onlyOnDetail(),
];
}

View File

@@ -80,27 +80,27 @@ class Episode extends Resource
ID::make()
->sortable(),
Avatar::make('Image')
Avatar::make(__('Image'))
->squared()
->thumbnail(function () {
return $this->data['image'];
})
->exceptOnForms(),
Tags::make('Tags')
Tags::make(__('Tags'))
->type('library_item')
->withLinkToTagResource(Tag::class),
Text::make('Title', 'data->title')
Text::make(__('Title'), 'data->title')
->readonly()
->rules('required', 'string'),
Code::make('Data')
Code::make(__('Data'), 'data')
->readonly()
->rules('required', 'json')
->json(),
BelongsTo::make('Podcast')
BelongsTo::make(__('Podcast'), 'podcast', Podcast::class)
->readonly(),
];

View File

@@ -70,6 +70,7 @@ class Event extends Resource
->displayUsing(fn($value) => $value->asDateTime()),
BelongsTo::make('Course'),
BelongsTo::make('Venue')
->searchable(),