Skip to content

Commit 903afd3

Browse files
committed
Compiled assets by laravel-mix & serviceWorker manually added :site worked OFFLINE :)
1 parent 1e6fa90 commit 903afd3

File tree

84 files changed

+5627
-59118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5627
-59118
lines changed

README.md

+51-57
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,67 @@
66
npm install admin-lte vue-router vuex @fortawesome/fontawesome-free moment vform view-design vue-i18n
77
npm install
88
npm run watch-poll
9-
```
10-
11-
# Polymorphic Relationship
129

13-
### One to Many (Images with Product, User , Brand, Category etc :smile:
14-
15-
> ### ` php artisan make:model Image -mc `
10+
composer require silviolleite/laravelpwa
11+
```
12+
## PWA
1613

17-
```php
18-
//[...] database/migrations/2020_11_13_154946_create_images_table.php
14+
`composer require silviolleite/laravelpwa`
15+
`php artisan vendor:publish --provider="LaravelPWA\Providers\LaravelPWAServiceProvider"`
1916

20-
Schema::create('images', function (Blueprint $table) {
21-
$table->id();
22-
$table->morphs('imageable');
23-
// $table->unsignedBigInteger('imageable_id')->index();
24-
// $table->string('imageable_type');
25-
$table->timestamps();
26-
});
17+
``` html
18+
<!DOCTYPE html>
19+
<html >
20+
<head>
21+
<meta charset="utf-8">
22+
<meta name="viewport" content="width=device-width, initial-scale=1">
23+
<meta http-equiv="x-ua-compatible" content="ie=edge">
2724

28-
```
25+
<title>{{ env('APP_NAME' ,'Admin Panel') }}</title>
26+
<!-- CSRF Token -->
27+
<meta name="csrf-token" content="{{ csrf_token() }}">
28+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
2929

30-
```php
31-
<?php
30+
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
31+
<link rel="manifest" href="{{ asset('manifest.json') }}" />
32+
<meta name="theme-color" content="#FFFFFF" />
33+
@laravelPWA
34+
<!-- Just add above line -->
35+
<script>
3236
33-
namespace App\Models;
37+
(function () {
38+
window.Laravel = {
39+
csrfToken: '{{ csrf_token() }}'
40+
};
41+
})();
3442
35-
use Illuminate\Database\Eloquent\Model;
43+
</script>
44+
<!-- Google Font: Source Sans Pro -->
45+
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
46+
</head>
47+
<body class="hold-transition sidebar-mini">
48+
<div id="admin">
49+
@if (Auth::guard('admin')->check())
50+
<admin-app :user="{{ Auth::guard('admin')->user() }}"></admin-app>
51+
@else
52+
<admin-app :user="false"></admin-app>
53+
@endif
54+
</div>
3655

37-
class Image extends Model
38-
{
39-
public function imageable()
40-
{
41-
return $this->morphTo();
42-
}
43-
}
44-
```
45-
```php
46-
class Product extends Model
47-
{
48-
public function images()
49-
{
50-
return $this->morphMany('App\Models\Image', 'imageable');
51-
// imageable is method came from Image Model
52-
}
53-
}
54-
```
55-
```php
56-
class Post extends Model
57-
{
58-
public function images()
59-
{
60-
return $this->morphMany('App\Models\Image', 'imageable');
61-
// imageable is method came from Image Model
62-
}
63-
}
56+
<script>
57+
window.adminUser = @json(auth()->guard('admin')->user());
58+
</script>
59+
<!-- REQUIRED SCRIPTS -->
60+
<script src="{{mix('js/admin.js')}}" defer></script>
61+
</body>
62+
</html>
6463
```
64+
JUST Edit `config/laravelpwa.php`
65+
Assets,SW will auto generated .
6566

66-
```php
67-
class Brand extends Model
68-
{
69-
public function images()
70-
{
71-
return $this->morphMany('App\Models\Image', 'imageable');
72-
// imageable is method came from Image Model
73-
}
74-
}
75-
```
7667

68+
Just Visit your site now.
7769

70+
and Install Your PWA App
7871

72+
* Happy Coding

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"guzzlehttp/guzzle": "^7.0.1",
1515
"laravel/framework": "^8.0",
1616
"laravel/tinker": "^2.0",
17-
"laravel/ui": "^3.0"
17+
"laravel/ui": "^3.0",
18+
"silviolleite/laravelpwa": "^2.0"
1819
},
1920
"require-dev": {
2021
"barryvdh/laravel-debugbar": "^3.5",

0 commit comments

Comments
 (0)