### PWA Configuration Example
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Example of the PWA configuration file (config/pwa.php) showing manifest details and other settings.
```php
return [
'install-button' => true,
'manifest' => [
'name' => 'Laravel PWA',
'short_name' => 'LPT',
'background_color' => '#6777ef',
'display' => 'fullscreen',
'description' => 'A Progressive Web Application setup for Laravel projects.',
'theme_color' => '#6777ef',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
],
'debug' => env('APP_DEBUG', false),
'livewire-app' => false,
];
```
--------------------------------
### Install Laravel PWA Package
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Install the package using Composer and run the artisan command to set up PWA functionalities.
```bash
composer require erag/laravel-pwa
php artisan erag:install-pwa
```
--------------------------------
### Publish PWA Configuration
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
After installation, publish the PWA configuration files to create `config/pwa.php` and set up PWA functionality.
```bash
php artisan erag:install-pwa
```
--------------------------------
### Clone the Forked Repository
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/CONTRIBUTING.md
Clone your forked repository to start contributing.
```bash
git clone https://github.com/your-username/laravel-pwa.git
```
--------------------------------
### Main PWA Configuration File
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
Customize PWA settings such as the install button visibility, manifest details (name, icons, colors), and debug mode in `config/pwa.php`.
```php
return [
'install-button' => true, // Show or hide the install button globally.
'manifest' => [
'name' => 'Laravel PWA',
'short_name' => 'LPT',
'background_color' => '#6777ef',
'display' => 'fullscreen',
'description' => 'A Progressive Web Application setup for Laravel projects.',
'theme_color' => '#6777ef',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
],
'debug' => env('APP_DEBUG', false), // Show or hide console.log in the browser globally.
'livewire-app' => false,
];
```
--------------------------------
### Install Laravel PWA Package
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
Install the package using Composer. This is the first step to integrate PWA functionality into your Laravel application.
```bash
composer require erag/laravel-pwa
```
--------------------------------
### Blade Layout Example
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Integrate PWA functionalities into your main Blade layout using the @PwaHead and @RegisterServiceWorkerScript directives.
```blade
@PwaHead
{{ config('app.name') }}
{{ $slot ?? '' }}
@RegisterServiceWorkerScript
```
--------------------------------
### Controller Example for Manifest Update
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Controller method to update the PWA manifest dynamically based on request data.
```php
namespace App\Http\Controllers;
use EragLaravelPwa\Facades\PWA;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class PwaSettingsController extends Controller
{
public function updateManifest(Request $request): RedirectResponse
{
$updated = PWA::update([
'name' => $request->string('name')->toString(),
'short_name' => $request->string('short_name')->toString(),
'background_color' => '#111827',
'display' => 'standalone',
'description' => 'Custom PWA manifest generated from admin settings.',
'theme_color' => '#111827',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
]);
return back()->with(
$updated ? 'status' : 'error',
$updated ? 'PWA manifest updated.' : 'PWA manifest update failed.'
);
}
}
```
--------------------------------
### Uploaded File Information
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
Example of the array structure received when a file is uploaded, specifically for the 'logo' input.
```php
array:2 [▼ // EragLaravelPwa/src/Core/PWA.php:19
"_token" => "iKbZh21VsYZMpNd9TN12Ul5SoysQzkMXlQkhB5Ub"
"logo" => Illuminate\Http\UploadedFile{#1426 ▶}]
```
--------------------------------
### Controller Example for Logo Upload
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Controller method to process an uploaded logo using the PWA::processLogo helper, validating image type, dimensions, and size.
```php
namespace App\Http\Controllers;
use EragLaravelPwa\Core\PWA;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class SettingsController extends Controller
{
public function uploadLogo(Request $request): RedirectResponse
{
$response = PWA::processLogo($request);
if ($response['status']) {
return back()->with('success', $response['message']);
}
return back()->withErrors($response['errors'] ?? [$response['error'] ?? 'Something went wrong.']);
}
}
```
--------------------------------
### Enable Livewire Support in Config
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Set the 'livewire-app' configuration option to true to enable Livewire integration.
```php
'livewire-app' => true,
```
--------------------------------
### Runtime Manifest Writes with Facade
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/SKILL.md
Use the PWA facade for writing manifest data at runtime.
```php
use EragLaravelPwa\Facades\PWA;
// ...
PWA::processLogo($request);
```
--------------------------------
### Runtime Manifest Update using Facade
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Update the public manifest.json file at runtime using the PWA facade with new configuration values.
```php
use EragLaravelPwa\Facades\PWA;
PWA::update([
'name' => 'Laravel Apps',
'short_name' => 'LA',
'background_color' => '#6777ef',
'display' => 'fullscreen',
'description' => 'A Progressive Web Application setup for Laravel projects.',
'theme_color' => '#6777ef',
'icons' => [
[
'src' => 'logo.png',
'sizes' => '512x512',
'type' => 'image/png',
],
],
]);
```
--------------------------------
### Update Manifest Command
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Regenerate the published manifest file after making changes to the PWA configuration.
```bash
php artisan erag:update-manifest
```
--------------------------------
### Register Service Provider for Laravel v11.x+
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
For Laravel versions 11.x, 12.x, and 13.x, ensure the service provider is registered in your `/bootstrap/providers.php` file.
```php
use EragLaravelPwa\EragLaravelPwaServiceProvider;
return [
// ...
EragLaravelPwaServiceProvider::class,
];
```
--------------------------------
### Handle PNG Logo Upload
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/SKILL.md
Process PNG logo uploads using the PWA core class.
```php
use EragLaravelPwa\Core\PWA;
// ...
PWA::processLogo($request);
```
--------------------------------
### Register Service Provider (Laravel 11+)
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
For Laravel versions 11, 12, and 13, register the service provider in the bootstrap/providers.php file.
```php
use EragLaravelPwa\EragLaravelPwaServiceProvider;
return [
// ...
EragLaravelPwaServiceProvider::class,
];
```
--------------------------------
### Livewire Blade Directives
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Continue using the same Blade directives (@PwaHead and @RegisterServiceWorkerScript) in your main layout when Livewire is enabled.
```blade
@PwaHead
@RegisterServiceWorkerScript
```
--------------------------------
### Controller Method for Logo Upload
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
A controller method to handle the logo upload process using the PWA Facade. It redirects back with success or error messages.
```php
namespace App\Http\Controllers;
use EragLaravelPwa\Core\PWA;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class SettingsController extends Controller
{
public function uploadLogo(Request $request)
{
$response = PWA::processLogo($request);
if ($response['status']) {
return redirect()->back()->with('success', $response['message']);
}
return redirect()->back()->withErrors($response['errors'] ?? ['Something went wrong.']);
}
}
```
--------------------------------
### Blade Layout for PWA Shell
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
Integrate the frontend app within a Blade layout, ensuring the necessary PWA directives are included in the head and body.
```blade
@vite(['resources/js/app.js'])
@PwaHead
@RegisterServiceWorkerScript
```
--------------------------------
### Include PWA Meta Tags in Layout
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
Add the `@PwaHead` directive within the `` section of your main layout file to include necessary PWA meta tags.
```blade
@PwaHead
Your App Title
```
--------------------------------
### Register Service Provider (Laravel 8-10)
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
For Laravel versions 8, 9, and 10, register the service provider in the config/app.php file.
```php
'providers' => [
// ...
EragLaravelPwa\EragLaravelPwaServiceProvider::class,
],
```
--------------------------------
### Logo Upload Input
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/reference.md
HTML input element for uploading a logo file, with constraints on file type and size.
```html
```
--------------------------------
### Include PWA Head Directive
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/resources/boost/skills/laravel-pwa-setup/SKILL.md
Place this Blade directive within the `` section of your layout file.
```blade
@PwaHead
```
--------------------------------
### Register Service Worker Script in Layout
Source: https://github.com/eramitgupta/laravel-pwa/blob/main/README.md
Place the `@RegisterServiceWorkerScript` directive just before the closing `` tag in your main layout file to register the service worker.
```blade
@RegisterServiceWorkerScript
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.