Merge branch 'develop' of lab.s-web.fr:ldc-web/projets/com-app-bo into develop

This commit is contained in:
Vincent BRIDIER 2025-09-04 20:39:49 +02:00
commit a2e0a60d08
8 changed files with 14 additions and 15 deletions

View file

@ -183,7 +183,7 @@ class SyncController extends Controller
->exists(sprintf('docs/%s/%s.%s', \tenant()->getKey(), $doc['uuid'], $doc['type']));
if ($exists) {
array_push($attach, URL::temporarySignedRoute(
'bo.docs.download',
'docs.download',
now()->addDays(30),
['tenant' => \tenant()->getKey(), 'uuid' => $doc['uuid']]
));

View file

@ -209,14 +209,15 @@ class DocumentController extends Controller
/**
* Download the document
*
* @param string $tenant
* @param string $uuid
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function download(string $uuid): \Symfony\Component\HttpFoundation\BinaryFileResponse
public function download(string $tenant, string $uuid): \Symfony\Component\HttpFoundation\BinaryFileResponse
{
$doc = Document::where('uuid', $uuid)->firstOrFail();
$pathToFile = public_path() . Storage::url(
sprintf('docs/%s/%s.%s', \tenant()->getKey(), $doc->uuid, $doc->type)
sprintf('docs/%s/%s.%s', $tenant, $doc->uuid, $doc->type)
);
return response()->download($pathToFile, $doc->path);
}

View file

@ -8,6 +8,7 @@ use App\Traits\Models\IsRelatedToTenant;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Stancl\Tenancy\Contracts\Tenant as BaseTenant;
use Stancl\Tenancy\Database\Concerns\BelongsToTenant;
use Uwil\LaravelCommon\Helpers\ToolboxHelper;
@ -104,7 +105,7 @@ class Formulary extends Model
private static function assertNameIsUnique(
string|null $name,
?int $id = null,
\App\Models\Tenant|\Stancl\Tenancy\Contracts\Tenant $tenant = null
Tenant|BaseTenant|null $tenant = null
) {
$table = (new self())->getTable();
ToolboxHelper::assertFieldIsUnique($table, 'name', $name, $id, self::whereTenantQuery($tenant));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -8,6 +8,5 @@
@section('button', true)
@section('image')
{{-- FIXME: Personaliser ca --}}
<img src="" class="logo img-fluid" alt="{{ config('app.name') }}">
<img src="{{ Vite::asset('resources/assets/images/logo.png') }}" class="logo img-fluid" alt="{{ config('app.name') }}">
@endsection

View file

@ -8,6 +8,5 @@
@section('button', true)
@section('image')
{{-- FIXME: Personaliser ca --}}
<img src="" class="logo img-fluid" alt="{{ config('app.name') }}">
<img src="{{ Vite::asset('resources/assets/images/logo.png') }}" class="logo img-fluid" alt="{{ config('app.name') }}">
@endsection

View file

@ -6,6 +6,5 @@
@section('submessage', __('Le site est en maintenance, nous reviendrons...'))
@section('image')
{{-- FIXME: Personaliser ca --}}
<img src="" class="logo img-fluid" alt="{{ config('app.name') }}">
<img src="{{ Vite::asset('resources/assets/images/logo.png') }}" class="logo img-fluid" alt="{{ config('app.name') }}">
@endsection

View file

@ -104,10 +104,10 @@ Route::middleware(['web', 'admin-secure'])->name('bo.')->group(function () {
])->where('direction', 'up|down')
->name('formularies.change-order');
});
// * Public files download
Route::get('/docs/{uuid}/download', [DocumentController::class, 'download'])
->name('docs.download')
->middleware('signed');
});
});
// Public files download.
Route::get('/{tenant}/docs/{uuid}/download', [DocumentController::class, 'download'])
->name('docs.download')
->middleware('signed');