Skip to content

Commit

Permalink
Fontawesome upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
heloufir committed Sep 24, 2022
1 parent fbad202 commit 79230d2
Show file tree
Hide file tree
Showing 6 changed files with 1,815 additions and 902 deletions.
8 changes: 5 additions & 3 deletions app/Http/Livewire/Administration/TicketPrioritiesDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Livewire\Administration;

use App\Models\Icon;
use App\Models\TicketPriority;
use Closure;
use Filament\Forms\Components\ColorPicker;
Expand Down Expand Up @@ -71,9 +72,10 @@ protected function getFormSchema(): array
->reactive()
->searchable()
->required()
->hint(fn(Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
->helperText(new HtmlString(__("Check the <a href='https://fontawesome.com/icons' target='_blank' class='text-blue-500 underline'>fontawesome icons here</a> to choose your right icon")))
->options(DB::table('icons')->get()->pluck('icon', 'icon')->toArray()),
->getSearchResultsUsing(fn (string $search) => Icon::where('icon', 'like', "%{$search}%")->limit(50)->pluck('icon', 'icon'))
->getOptionLabelUsing(fn ($value): ?string => Icon::where('icon', $value)->first()?->icon)
->hint(fn (Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
->helperText(new HtmlString(__("Check the <a href='https://fontawesome.com/icons' target='_blank' class='text-blue-500 underline'>fontawesome icons here</a> to choose your right icon"))),
];
}

Expand Down
6 changes: 4 additions & 2 deletions app/Http/Livewire/Administration/TicketTypesDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Livewire\Administration;

use App\Models\Icon;
use App\Models\TicketType;
use Filament\Forms\Components\ColorPicker;
use Filament\Forms\Components\Select;
Expand Down Expand Up @@ -70,9 +71,10 @@ protected function getFormSchema(): array
->reactive()
->searchable()
->required()
->getSearchResultsUsing(fn (string $search) => Icon::where('icon', 'like', "%{$search}%")->limit(50)->pluck('icon', 'icon'))
->getOptionLabelUsing(fn ($value): ?string => Icon::where('icon', $value)->first()?->icon)
->hint(fn (Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
->helperText(new HtmlString(__("Check the <a href='https://fontawesome.com/icons' target='_blank' class='text-blue-500 underline'>fontawesome icons here</a> to choose your right icon")))
->options(DB::table('icons')->get()->pluck('icon', 'icon')->toArray()),
->helperText(new HtmlString(__("Check the <a href='https://fontawesome.com/icons' target='_blank' class='text-blue-500 underline'>fontawesome icons here</a> to choose your right icon"))),
];
}

Expand Down
15 changes: 15 additions & 0 deletions app/Models/Icon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Icon extends Model
{
use HasFactory;

protected $fillable = [
'icon'
];
}
32 changes: 32 additions & 0 deletions database/migrations/2022_09_08_094911_create_icons_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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('icons', function (Blueprint $table) {
$table->id();
$table->string('icon');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('icons');
}
};
Loading

0 comments on commit 79230d2

Please sign in to comment.