feat: Persian panel/API fixes and structural-model tweaks
- lang/fa: add validation/auth/passwords/pagination translations so admin and API validation errors are in Persian - templates: soft-delete instead of cascade-deleting their generations; keep resolving trashed template on generations (labels/downloads) - templates: add TemplateInfolist with a real thumbnail ImageEntry - generations: auto-name template-based generations and use that name for the download file and as a searchable column - admin: show all dates as Jalali via ->jalaliDate()/->jalaliDateTime() Filament macros (App\Support\Jalali) - wallets: harden the deposit/withdraw action to surface the exact error instead of a 500 - profile: normalize Iranian mobile numbers (App\Support\Mobile), add social_links, coerce notification-preference booleans, require the current password to delete an account Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013P66ea1dC5CVM9t29496t5
This commit is contained in:
@@ -12,6 +12,7 @@ use App\Http\Resources\TemplateGenerationResource;
|
||||
use App\Jobs\GenerateTemplateJob;
|
||||
use App\Models\Template;
|
||||
use App\Models\TemplateGeneration;
|
||||
use App\Support\Jalali;
|
||||
use App\Traits\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -80,6 +81,7 @@ class TemplateGenerationController extends Controller
|
||||
$generation = TemplateGeneration::query()->create([
|
||||
'template_id' => $template->id,
|
||||
'uuid' => $uuid,
|
||||
'title' => $this->buildGenerationTitle($template, $request),
|
||||
'status' => TemplateGenerationStatus::Pending,
|
||||
'values' => $storedValues,
|
||||
'requested_by' => $request->user()->id,
|
||||
@@ -264,6 +266,13 @@ class TemplateGenerationController extends Controller
|
||||
abort_if($generation->requested_by !== request()->user()->id, Response::HTTP_FORBIDDEN);
|
||||
abort_if($generation->status !== TemplateGenerationStatus::Completed || ! $generation->output_path, Response::HTTP_NOT_FOUND);
|
||||
|
||||
return Storage::disk('local')->download($generation->output_path, $generation->template->slug.'.pptx');
|
||||
return Storage::disk('local')->download($generation->output_path, $generation->downloadFilename().'.pptx');
|
||||
}
|
||||
|
||||
private function buildGenerationTitle(Template $template, Request $request): string
|
||||
{
|
||||
$label = $request->user()?->name ?: 'کاربر';
|
||||
|
||||
return sprintf('%s - %s - %s', $template->title, $label, Jalali::date(now()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user