Skip to content

Commit 96f4466

Browse files
authored
Merge pull request #72 from dsbilling/add-logo-to-companies
2 parents 3353a25 + 8aaa267 commit 96f4466

File tree

6 files changed

+45
-10
lines changed

6 files changed

+45
-10
lines changed

app/Filament/Resources/CompanyResource.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Filament\Resources\CompanyResource\RelationManagers\CertificationsRelationManager;
77
use App\Filament\Resources\CompanyResource\RelationManagers\CoursesRelationManager;
88
use App\Models\Company;
9+
use Filament\Forms\Components\FileUpload;
910
use Filament\Forms\Components\TextInput;
1011
use Filament\Forms\Form;
1112
use Filament\Resources\Resource;
@@ -26,6 +27,12 @@ public static function form(Form $form): Form
2627
->autofocus()
2728
->required()
2829
->placeholder(__('Name')),
30+
31+
FileUpload::make('logo')
32+
->image()
33+
->directory('companies')
34+
->imageCropAspectRatio('1:1')
35+
->preserveFilenames(),
2936
]);
3037
}
3138

app/Models/Company.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class Company extends Model
1212
use HasFactory;
1313
use SoftDeletes;
1414

15-
protected $fillable = ['name'];
15+
protected $fillable = [
16+
'name',
17+
'logo',
18+
];
1619

17-
/**
18-
* Get the certifications for the company.
19-
*/
2020
public function certifications(): HasMany
2121
{
2222
return $this->hasMany(Certification::class);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
public function up(): void
13+
{
14+
Schema::table('companies', function (Blueprint $table) {
15+
$table->string('logo')->nullable();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('companies', function (Blueprint $table) {
25+
$table->dropColumn('logo');
26+
});
27+
}
28+
};
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"src": "resources/js/app.css"
1313
},
1414
"resources/css/app.css": {
15-
"file": "assets/app.3cc7b30f.css",
15+
"file": "assets/app.97c1f6e4.css",
1616
"src": "resources/css/app.css",
1717
"isEntry": true
1818
}

resources/views/home.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ class="inline-flex items-center gap-2 justify-center rounded-md py-2 px-3 text-s
104104
<ol class="mt-6 space-y-4">
105105
@foreach($experiences as $experience)
106106
<li class="flex gap-4">
107-
{{--<div class="relative mt-1 flex h-10 w-10 flex-none items-center justify-center rounded-full shadow-md shadow-slate-800/5 ring-1 ring-slate-900/5 dark:border dark:border-slate-700/50 dark:bg-slate-800 dark:ring-0">
108-
<img alt="{{ $experience->company->name }}" loading="lazy" width="32" height="32" decoding="async" data-nimg="1" class="h-7 w-7" style="color:transparent" src="">
109-
</div>--}}
107+
<div class="relative mt-1 flex h-10 w-10 flex-none items-center justify-center rounded-full shadow-md shadow-slate-800/5 ring-1 ring-slate-900/5 dark:border dark:border-slate-700/50 dark:bg-slate-800 dark:ring-0 overflow-clip">
108+
<img alt="{{ $experience->company->name }}" loading="lazy" width="32" height="32" decoding="async" data-nimg="1" class="h-10 w-10 text-transparent" src="{{ $experience->company->logo }}">
109+
</div>
110110
<dl class="flex flex-auto flex-wrap gap-x-2">
111111
<dt class="sr-only">Company</dt>
112-
<dd class="w-full flex-none text-sm font-medium text-slate-900 dark:text-slate-100">
112+
<dd class="w-full flex-none text-sm font-semibold text-slate-900 dark:text-slate-100">
113113
{{ $experience->company->name }}
114114
</dd>
115115
<dt class="sr-only">Role</dt>

0 commit comments

Comments
 (0)