lecturer description added

This commit is contained in:
Benjamin Takats
2022-12-02 22:57:22 +01:00
parent e362cf6f18
commit 3749c3653b
8 changed files with 292 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Laravel\Nova\Trix\PruneStaleAttachments;
class Kernel extends ConsoleKernel
{
@@ -15,7 +16,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->call(new PruneStaleAttachments)->daily();
}
/**

View File

@@ -45,7 +45,7 @@ class LecturerTable extends DataTableComponent
]),
Column::make("Name", "name")
->sortable(),
BooleanColumn::make("Aktiv", "active")
BooleanColumn::make("Aktiv", 'active')
->sortable(),
Column::make('Kurse')
->label(

View File

@@ -49,6 +49,8 @@ class Lecturer extends Model implements HasMedia
$this->addMediaCollection('avatar')
->singleFile()
->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png'));
$this->addMediaCollection('images')
->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png'));
}
/**

View File

@@ -8,6 +8,7 @@ use Laravel\Nova\Fields\BelongsTo;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Field;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Markdown;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
@@ -56,8 +57,12 @@ class Lecturer extends Resource
ID::make()
->sortable(),
Images::make('Avatar', 'avatar') // second parameter is the media collection name
->conversionOnIndexView('thumb'), // conversion used to display the image
Images::make('Avatar', 'avatar')
->conversionOnIndexView('thumb'),
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.'),
Text::make('Name')
->rules('required', 'string'),
@@ -70,6 +75,10 @@ class Lecturer extends Resource
->rules('required')
->default(true),
Markdown::make('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.'),
BelongsTo::make('Team'),
];

View File

@@ -26,6 +26,7 @@
"sentry/sentry-laravel": "^3.1",
"simplesoftwareio/simple-qrcode": "^4.2",
"spatie/laravel-google-fonts": "^1.2",
"spatie/laravel-markdown": "^2.2",
"spatie/laravel-medialibrary": "^10.0.0",
"spatie/laravel-sluggable": "^3.4",
"staudenmeir/eloquent-has-many-deep": "^1.7",

200
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ff5b859d3c6ae9f19b73878a2e055f42",
"content-hash": "568870ac3cd35dadcdbedcc3bd76c682",
"packages": [
{
"name": "akuechler/laravel-geoly",
@@ -6204,6 +6204,66 @@
},
"time": "2022-08-12T19:00:25+00:00"
},
{
"name": "spatie/commonmark-shiki-highlighter",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/commonmark-shiki-highlighter.git",
"reference": "52528a02f61d84030b313b5c7b0c4dd8edca7187"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/commonmark-shiki-highlighter/zipball/52528a02f61d84030b313b5c7b0c4dd8edca7187",
"reference": "52528a02f61d84030b313b5c7b0c4dd8edca7187",
"shasum": ""
},
"require": {
"league/commonmark": "^2.0",
"php": "^8.0",
"spatie/shiki-php": "^1.1.1",
"symfony/process": "^5.3|^6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19",
"phpunit/phpunit": "^9.5",
"spatie/phpunit-snapshot-assertions": "^4.2.7",
"spatie/ray": "^1.28"
},
"type": "commonmark-extension",
"autoload": {
"psr-4": {
"Spatie\\CommonMarkShikiHighlighter\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "Highlight code blocks with league/commonmark and Shiki",
"homepage": "https://github.com/spatie/commonmark-shiki-highlighter",
"keywords": [
"commonmark-shiki-highlighter",
"spatie"
],
"support": {
"source": "https://github.com/spatie/commonmark-shiki-highlighter/tree/2.1.1"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-11-28T08:03:04+00:00"
},
{
"name": "spatie/image",
"version": "2.2.4",
@@ -6406,6 +6466,81 @@
],
"time": "2022-09-07T10:01:34+00:00"
},
{
"name": "spatie/laravel-markdown",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-markdown.git",
"reference": "fbc1932b9513f4ee3ec83ac00537d92c188fc3cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-markdown/zipball/fbc1932b9513f4ee3ec83ac00537d92c188fc3cb",
"reference": "fbc1932b9513f4ee3ec83ac00537d92c188fc3cb",
"shasum": ""
},
"require": {
"illuminate/cache": "^8.49|^9.0",
"illuminate/contracts": "^8.37|^9.0",
"illuminate/support": "^8.49|^9.0",
"illuminate/view": "^8.49|^9.0",
"league/commonmark": "^2.2",
"php": "^8.0",
"spatie/commonmark-shiki-highlighter": "^2.0",
"spatie/laravel-package-tools": "^1.4.3"
},
"require-dev": {
"brianium/paratest": "^6.2",
"nunomaduro/collision": "^5.3|^6.0",
"orchestra/testbench": "^6.15|^7.0",
"phpunit/phpunit": "^9.3",
"spatie/laravel-ray": "^1.23",
"spatie/phpunit-snapshot-assertions": "^4.2",
"vimeo/psalm": "^4.8"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\LaravelMarkdown\\MarkdownServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\LaravelMarkdown\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "A highly configurable markdown renderer and Blade component for Laravel",
"homepage": "https://github.com/spatie/laravel-markdown",
"keywords": [
"Laravel-Markdown",
"laravel",
"spatie"
],
"support": {
"source": "https://github.com/spatie/laravel-markdown/tree/2.2.4"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-05-21T11:53:53+00:00"
},
{
"name": "spatie/laravel-medialibrary",
"version": "10.7.3",
@@ -6778,6 +6913,69 @@
],
"time": "2022-04-21T12:23:20+00:00"
},
{
"name": "spatie/shiki-php",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/shiki-php.git",
"reference": "34fe61405b405c735c82a9c56feffd3f7c5544ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/shiki-php/zipball/34fe61405b405c735c82a9c56feffd3f7c5544ff",
"reference": "34fe61405b405c735c82a9c56feffd3f7c5544ff",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.0",
"pestphp/pest": "^1.8",
"phpunit/phpunit": "^9.5",
"spatie/pest-plugin-snapshots": "^1.1",
"spatie/ray": "^1.10"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\ShikiPhp\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Rias Van der Veken",
"email": "rias@spatie.be",
"role": "Developer"
},
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"role": "Developer"
}
],
"description": "Highlight code using Shiki in PHP",
"homepage": "https://github.com/spatie/shiki-php",
"keywords": [
"shiki",
"spatie"
],
"support": {
"source": "https://github.com/spatie/shiki-php/tree/1.3.0"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2022-06-01T11:28:41+00:00"
},
{
"name": "spatie/temporary-directory",
"version": "2.1.1",

View File

@@ -0,0 +1,46 @@
<?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('nova_pending_trix_attachments', function (Blueprint $table) {
$table->increments('id');
$table->string('draft_id')
->index();
$table->string('attachment');
$table->string('disk');
$table->timestamps();
});
Schema::create('nova_trix_attachments', function (Blueprint $table) {
$table->increments('id');
$table->string('attachable_type');
$table->unsignedInteger('attachable_id');
$table->string('attachment');
$table->string('disk');
$table->string('url')
->index();
$table->timestamps();
$table->index(['attachable_type', 'attachable_id']);
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
//
}
};

View File

@@ -0,0 +1,30 @@
<?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::table('lecturers', function (Blueprint $table) {
$table->longText('description')
->nullable();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::table('lecturers', function (Blueprint $table) {
//
});
}
};