Skip to content

Commit 30f1733

Browse files
authored
Merge pull request #80 from devaslanphp/dev
Upgrade fontawesome data
2 parents d5d524b + d71b744 commit 30f1733

File tree

7 files changed

+1823
-905
lines changed

7 files changed

+1823
-905
lines changed

app/Http/Livewire/Administration/TicketPrioritiesDialog.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Livewire\Administration;
44

5+
use App\Models\Icon;
56
use App\Models\TicketPriority;
67
use Closure;
78
use Filament\Forms\Components\ColorPicker;
@@ -71,9 +72,10 @@ protected function getFormSchema(): array
7172
->reactive()
7273
->searchable()
7374
->required()
74-
->hint(fn(Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
75-
->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")))
76-
->options(DB::table('icons')->get()->pluck('icon', 'icon')->toArray()),
75+
->getSearchResultsUsing(fn (string $search) => Icon::where('icon', 'like', "%{$search}%")->limit(50)->pluck('icon', 'icon'))
76+
->getOptionLabelUsing(fn ($value): ?string => Icon::where('icon', $value)->first()?->icon)
77+
->hint(fn (Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
78+
->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"))),
7779
];
7880
}
7981

app/Http/Livewire/Administration/TicketTypesDialog.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Livewire\Administration;
44

5+
use App\Models\Icon;
56
use App\Models\TicketType;
67
use Filament\Forms\Components\ColorPicker;
78
use Filament\Forms\Components\Select;
@@ -70,9 +71,10 @@ protected function getFormSchema(): array
7071
->reactive()
7172
->searchable()
7273
->required()
74+
->getSearchResultsUsing(fn (string $search) => Icon::where('icon', 'like', "%{$search}%")->limit(50)->pluck('icon', 'icon'))
75+
->getOptionLabelUsing(fn ($value): ?string => Icon::where('icon', $value)->first()?->icon)
7376
->hint(fn (Closure $get) => $get('icon') ? new HtmlString(__('Selected icon:') . ' <i class="fa fa-2x ' . $get('icon') . '"></i>') : '')
74-
->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")))
75-
->options(DB::table('icons')->get()->pluck('icon', 'icon')->toArray()),
77+
->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"))),
7678
];
7779
}
7880

app/Models/Icon.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Icon extends Model
9+
{
10+
use HasFactory;
11+
12+
protected $fillable = [
13+
'icon'
14+
];
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('icons', function (Blueprint $table) {
17+
$table->id();
18+
$table->string('icon');
19+
$table->timestamps();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*
26+
* @return void
27+
*/
28+
public function down()
29+
{
30+
Schema::dropIfExists('icons');
31+
}
32+
};

0 commit comments

Comments
 (0)