-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba29924
commit c94d00d
Showing
13 changed files
with
194 additions
and
21 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -71,3 +71,5 @@ QUIZ_STATUS=false | |
TELEGRAM_BOT_TOKEN= | ||
TELEGRAM_CHAT_ID= | ||
TELEGRAM_CHANNEL_ID= | ||
|
||
SCOUT_DRIVER= |
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,59 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Casts\Attribute; | ||
use Illuminate\Database\Eloquent\Concerns\HasUuids; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Support\Str; | ||
use Laravel\Scout\Searchable; | ||
|
||
class DocumentationSection extends Model | ||
{ | ||
use HasFactory; | ||
use HasUuids; | ||
use Searchable; | ||
|
||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'id', | ||
'title', | ||
'slug', | ||
'version', | ||
'file', | ||
'content', | ||
]; | ||
|
||
protected function shortContent(): Attribute | ||
{ | ||
|
||
return Attribute::make( | ||
get: fn (mixed $value, array $attributes) => | ||
|
||
Str::limit( | ||
nl2br(strip_tags($attributes['content'])), | ||
90 | ||
), | ||
); | ||
} | ||
|
||
protected function fileForUrl(): Attribute | ||
{ | ||
return Attribute::make( | ||
get: fn (mixed $value, array $attributes) => str_replace('.md', '', $attributes['file']), | ||
); | ||
} | ||
|
||
public function toSearchableArray() | ||
{ | ||
return [ | ||
'title' => $this->title, | ||
'content' => $this->content, | ||
]; | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
database/migrations/2024_03_17_133145_create_documentation_sections_table.php
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,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Support\Str; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('documentation_sections', function (Blueprint $table) { | ||
$table->uuid('id')->primary(); | ||
$table->string('title_page')->comment('Заголовок всей страницы'); | ||
$table->string('title'); | ||
$table->string('slug'); | ||
$table->string('version'); | ||
$table->string('file'); | ||
$table->text('content'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('documentation_sections'); | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,14 @@ | ||
import { Controller } from '@hotwired/stimulus'; | ||
|
||
export default class extends Controller { | ||
static targets = [ "text", "spinner"] | ||
/** | ||
* Port for laravel.com | ||
*/ | ||
connect() {} | ||
search(event) { | ||
this.spinnerTarget.classList.remove('d-none'); | ||
event.target.form.requestSubmit(); | ||
setTimeout(() => this.spinnerTarget.classList.add('d-none'), 500) | ||
} | ||
} |
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,17 @@ | ||
<ul class="list-group" id="found_candidates"> | ||
@foreach($searchOffer as $offer) | ||
{{-- <li class="list-group-item fs-6 text fw-bold" style="font-size: 14px !important;">{{ $offer->title_page }}</li>--}} | ||
|
||
<a href="{{ route('docs', ['version' => $offer->version, 'page' => "{$offer->file_for_url}#{$offer->slug}" ]) }}" class="list-group-item list-group-item-action" aria-current="true"> | ||
<div class="d-flex w-100 justify-content-between"> | ||
<p class="mb-1 fw-bold font-monospace">{{ $offer->title_page }}</p> | ||
{{-- <small>3 days ago</small>--}} | ||
</div> | ||
{{-- @dd(Str::of($offer->content)->limit(20)->__toString())--}} | ||
<p class="mb-1">{{ $offer->title }}</p> | ||
<small>{!! $offer->short_content !!}</small> | ||
|
||
</a> | ||
@endforeach | ||
</ul> | ||
|
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