Laravel Application with PWA

Laravel Application with PWA

Install the following package

composer require ladumor/laravel-pwa

Adding service on app.php


'LaravelPwa' => \Ladumor\LaravelPwa\LaravelPwa::class,

To Publish configuration

php artisan laravel-pwa:publish

On main file app.blade.php add the manifest

<meta name="theme-color" content="#6777ef"/>
<link rel="apple-touch-icon" href="{{ asset('logo.png') }}">
<link rel="manifest" href="{{ asset('/manifest.json') }}">

On Root file add the following script

<script src="{{ asset('/sw.js') }}"></script>
    if (!navigator.serviceWorker.controller) {
        navigator.serviceWorker.register("/sw.js").then(function (reg) {
            console.log("Service worker has been registered for scope: " + reg.scope);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s