Compare commits
4 Commits
53a85b3b39
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dd3b35eb5 | ||
|
|
4129a7a251 | ||
|
|
d6aea93d00 | ||
|
|
fb91bea7c4 |
@@ -82,6 +82,9 @@ class ItemResource extends Resource
|
|||||||
Forms\Components\TextInput::make('category')
|
Forms\Components\TextInput::make('category')
|
||||||
->label('Category')
|
->label('Category')
|
||||||
->placeholder('Scan the Category'),
|
->placeholder('Scan the Category'),
|
||||||
|
Forms\Components\TextInput::make('category')
|
||||||
|
->label('Category')
|
||||||
|
->placeholder('Scan the Category'),
|
||||||
Forms\Components\TextInput::make('code')
|
Forms\Components\TextInput::make('code')
|
||||||
->required()
|
->required()
|
||||||
->placeholder('Scan the valid code')
|
->placeholder('Scan the valid code')
|
||||||
|
|||||||
@@ -170,7 +170,8 @@ class VisitorEntryResource extends Resource
|
|||||||
->disk('public')
|
->disk('public')
|
||||||
->height(50)
|
->height(50)
|
||||||
->width(50)
|
->width(50)
|
||||||
->defaultImageUrl('https://ui-avatars.com/api/?name=Visitor&background=555&color=fff')
|
// ->defaultImageUrl('https://ui-avatars.com/api/?name=Visitor&background=555&color=fff')
|
||||||
|
->defaultImageUrl(asset('images/profile.png'))
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->extraImgAttributes(['style' => 'border-radius: 6px; object-fit: cover;']),
|
->extraImgAttributes(['style' => 'border-radius: 6px; object-fit: cover;']),
|
||||||
Tables\Columns\TextColumn::make('type')
|
Tables\Columns\TextColumn::make('type')
|
||||||
|
|||||||
@@ -111,29 +111,29 @@ class CreateVisitorEntry extends CreateRecord
|
|||||||
!empty($data['photo']) &&
|
!empty($data['photo']) &&
|
||||||
str_starts_with($data['photo'], 'data:image')
|
str_starts_with($data['photo'], 'data:image')
|
||||||
) {
|
) {
|
||||||
$imageData = explode(',', $data['photo'])[1];
|
try {
|
||||||
|
$imageData = explode(',', $data['photo'])[1];
|
||||||
|
|
||||||
$filename = 'visitor_' . time() . '_' . uniqid() . '.jpg';
|
$filename = 'visitor_' . time() . '_' . uniqid() . '.jpg';
|
||||||
|
|
||||||
$path = 'uploads/visitor-photos/' . $filename;
|
$path = 'visitor-photos/' . $filename;
|
||||||
|
|
||||||
Storage::disk('local')->put(
|
$decoded = base64_decode($imageData);
|
||||||
$path,
|
|
||||||
base64_decode($imageData)
|
|
||||||
);
|
|
||||||
|
|
||||||
$decoded = base64_decode($imageData);
|
$saved = Storage::disk('public')->put($path, $decoded);
|
||||||
|
|
||||||
$saved = Storage::disk('local')->put($path, $decoded);
|
\Log::info('PHOTO UPLOAD (PUBLIC):', [
|
||||||
|
'filename' => $filename,
|
||||||
|
'path' => $path,
|
||||||
|
'size_bytes' => strlen($decoded),
|
||||||
|
'saved' => $saved ? 'SUCCESS' : 'FAILED',
|
||||||
|
]);
|
||||||
|
|
||||||
\Log::info('PHOTO UPLOAD: file details', [
|
$data['photo'] = $path;
|
||||||
'filename' => $filename,
|
|
||||||
'path' => $path,
|
|
||||||
'size_bytes' => strlen($decoded),
|
|
||||||
'saved' => $saved ? 'SUCCESS' : 'FAILED',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$data['photo'] = $path;
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('PHOTO UPLOAD ERROR: ' . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
Reference in New Issue
Block a user