Add (publish date): Change to datetime, show on view, save publishdate properly

add (composer): rss feed
This commit is contained in:
2023-07-31 00:21:18 +08:00
parent 3812976c0f
commit ad384c5fc2
44 changed files with 440 additions and 156 deletions

View File

@@ -10,6 +10,8 @@
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Spatie\Feed\Feedable;
use Spatie\Feed\FeedItem;
/** /**
* Class Post * Class Post
@@ -31,7 +33,7 @@
* @property Author|null $author * @property Author|null $author
* @property Collection|PostCategory[] $post_categories * @property Collection|PostCategory[] $post_categories
*/ */
class Post extends Model class Post extends Model implements Feedable
{ {
protected $table = 'posts'; protected $table = 'posts';
@@ -41,6 +43,7 @@ class Post extends Model
'comment_count' => 'int', 'comment_count' => 'int',
'likes_count' => 'int', 'likes_count' => 'int',
'featured' => 'bool', 'featured' => 'bool',
'publish_date' => 'datetime',
]; ];
protected $fillable = [ protected $fillable = [
@@ -98,4 +101,20 @@ public function getFeaturedImageLqipAttribute()
// Append "_lqip" before the extension to create the LQIP image URL // Append "_lqip" before the extension to create the LQIP image URL
return str_replace(".{$extension}", "_lqip.{$extension}", $featuredImage); return str_replace(".{$extension}", "_lqip.{$extension}", $featuredImage);
} }
public function toFeedItem(): FeedItem
{
return FeedItem::create()
->id($this->id)
->title($this->title)
->summary($this->excerpt)
->updated($this->publish_date)
->link(route('home.country.post', ['country' => $this->post_category?->category?->country_locale_slug, 'post_slug' => $this->slug]))
->authorName($this->author->name);
}
public static function getFeedItems()
{
return Post::where('status', 'publish')->latest()->get();
}
} }

View File

@@ -23,6 +23,7 @@
"laravel/tinker": "^2.8", "laravel/tinker": "^2.8",
"laravel/ui": "^4.0", "laravel/ui": "^4.0",
"league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-aws-s3-v3": "^3.0",
"spatie/laravel-feed": "^4.2",
"spatie/laravel-googletagmanager": "^2.6", "spatie/laravel-googletagmanager": "^2.6",
"spatie/laravel-sitemap": "^6.3", "spatie/laravel-sitemap": "^6.3",
"stevebauman/location": "^7.0", "stevebauman/location": "^7.0",

95
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "b3e1a1debea33ff4235be5b1c7bc3ee9", "content-hash": "f59f0312d1707f04742af712250d939d",
"packages": [ "packages": [
{ {
"name": "alaminfirdows/laravel-editorjs", "name": "alaminfirdows/laravel-editorjs",
@@ -4635,6 +4635,99 @@
}, },
"time": "2023-07-27T07:57:32+00:00" "time": "2023-07-27T07:57:32+00:00"
}, },
{
"name": "spatie/laravel-feed",
"version": "4.2.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-feed.git",
"reference": "0b9b7df3f716c6067b082cd6a985126c2189a6c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-feed/zipball/0b9b7df3f716c6067b082cd6a985126c2189a6c4",
"reference": "0b9b7df3f716c6067b082cd6a985126c2189a6c4",
"shasum": ""
},
"require": {
"illuminate/contracts": "^8.0|^9.0|^10.0",
"illuminate/http": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0",
"php": "^8.0",
"spatie/laravel-package-tools": "^1.9"
},
"require-dev": {
"orchestra/testbench": "^6.23|^7.0|^8.0",
"pestphp/pest": "^1.22",
"phpunit/phpunit": "^9.5",
"spatie/pest-plugin-snapshots": "^1.1",
"spatie/test-time": "^1.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Feed\\FeedServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\Feed\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jolita Grazyte",
"email": "jolita@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Sebastian De Deyne",
"email": "sebastian@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
},
{
"name": "Patrick Organ",
"homepage": "https://github.com/patinthehat",
"role": "Developer"
}
],
"description": "Generate rss feeds",
"homepage": "https://github.com/spatie/laravel-feed",
"keywords": [
"laravel",
"laravel-feed",
"rss",
"spatie"
],
"support": {
"source": "https://github.com/spatie/laravel-feed/tree/4.2.1"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2023-01-25T09:39:38+00:00"
},
{ {
"name": "spatie/laravel-googletagmanager", "name": "spatie/laravel-googletagmanager",
"version": "2.6.6", "version": "2.6.6",

57
config/feed.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
use App\Models\Post;
return [
'feeds' => [
'main' => [
/*
* Here you can specify which class and method will return
* the items that should appear in the feed. For example:
* [App\Model::class, 'getAllFeedItems']
*
* You can also pass an argument to that method. Note that their key must be the name of the parameter:
* [App\Model::class, 'getAllFeedItems', 'parameterName' => 'argument']
*/
'items' => [Post::class, 'getFeedItems'],
/*
* The feed will be available on this url.
*/
'url' => '/posts.rss',
'title' => 'ProductAlert',
'description' => 'Find top-rated product reviews at ProductAlert. Discover the latest trends, best brands, and right prices. Your guide to making the best purchase decisions!',
'language' => 'en-US',
/*
* The image to display for the feed. For Atom feeds, this is displayed as
* a banner/logo; for RSS and JSON feeds, it's displayed as an icon.
* An empty value omits the image attribute from the feed.
*/
'image' => 'https://cdn1.productalert.co/productalert-logo.jpg',
/*
* The format of the feed. Acceptable values are 'rss', 'atom', or 'json'.
*/
'format' => 'atom',
/*
* The view that will render the feed.
*/
'view' => 'feed::atom',
/*
* The mime type to be used in the <link> tag. Set to an empty string to automatically
* determine the correct value.
*/
'type' => '',
/*
* The content type for the feed response. Set to an empty string to automatically
* determine the correct value.
*/
'contentType' => '',
],
],
];

View File

@@ -12,7 +12,7 @@
public function up(): void public function up(): void
{ {
Schema::table('posts', function (Blueprint $table) { Schema::table('posts', function (Blueprint $table) {
$table->date('publish_date')->nullable()->after('author_id'); $table->datetime('publish_date')->nullable()->after('author_id');
}); });
} }

56
package-lock.json generated
View File

@@ -10,7 +10,9 @@
"@editorjs/header": "^2.7.0", "@editorjs/header": "^2.7.0",
"@editorjs/list": "^1.8.0", "@editorjs/list": "^1.8.0",
"@editorjs/paragraph": "^2.9.0", "@editorjs/paragraph": "^2.9.0",
"@vuepic/vue-datepicker": "^5.4.0",
"bootstrap-icons": "^1.10.5", "bootstrap-icons": "^1.10.5",
"date-fns": "^2.30.0",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"pinia": "^2.1.6", "pinia": "^2.1.6",
@@ -61,6 +63,17 @@
"node": ">=6.0.0" "node": ">=6.0.0"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.22.6",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.6.tgz",
"integrity": "sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ==",
"dependencies": {
"regenerator-runtime": "^0.13.11"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@codexteam/icons": { "node_modules/@codexteam/icons": {
"version": "0.0.6", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.6.tgz", "resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.6.tgz",
@@ -883,6 +896,21 @@
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.3.4.tgz",
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==" "integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ=="
}, },
"node_modules/@vuepic/vue-datepicker": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-5.4.0.tgz",
"integrity": "sha512-9f1ZqRDfak/UmBbD81BdqMDpUku2YphTwQXG8DF6hsrjIXsq5sX7BWJB6LhyVgvX9QFrSyFIp4fsHE3UFofZ7A==",
"dependencies": {
"date-fns": "^2.30.0",
"date-fns-tz": "^1.3.7"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"vue": ">=3.2.0"
}
},
"node_modules/@webassemblyjs/ast": { "node_modules/@webassemblyjs/ast": {
"version": "1.11.6", "version": "1.11.6",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz",
@@ -1384,6 +1412,29 @@
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.2.tgz",
"integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
}, },
"node_modules/date-fns": {
"version": "2.30.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",
"integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",
"dependencies": {
"@babel/runtime": "^7.21.0"
},
"engines": {
"node": ">=0.11"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/date-fns"
}
},
"node_modules/date-fns-tz": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.8.tgz",
"integrity": "sha512-qwNXUFtMHTTU6CFSFjoJ80W8Fzzp24LntbjFFBgL/faqds4e5mo9mftoRLgr3Vi1trISsg4awSpYVsOQCRnapQ==",
"peerDependencies": {
"date-fns": ">=2.0.0"
}
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -2216,6 +2267,11 @@
"node": ">=8.10.0" "node": ">=8.10.0"
} }
}, },
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
},
"node_modules/regex-parser": { "node_modules/regex-parser": {
"version": "2.2.11", "version": "2.2.11",
"resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz", "resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz",

View File

@@ -29,7 +29,9 @@
"@editorjs/header": "^2.7.0", "@editorjs/header": "^2.7.0",
"@editorjs/list": "^1.8.0", "@editorjs/list": "^1.8.0",
"@editorjs/paragraph": "^2.9.0", "@editorjs/paragraph": "^2.9.0",
"@vuepic/vue-datepicker": "^5.4.0",
"bootstrap-icons": "^1.10.5", "bootstrap-icons": "^1.10.5",
"date-fns": "^2.30.0",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"mitt": "^3.0.1", "mitt": "^3.0.1",
"pinia": "^2.1.6", "pinia": "^2.1.6",

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import{_ as Le,u as Zt,x as Oe,c as Ne,y as Re,z as De,o as Pe}from"./admin-app-be7eed0b.js";import"./index-8746c87e.js";var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function St(){}Object.assign(St,{default:St,register:St,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){const t=(this.document||this.ownerDocument).querySelectorAll(s);let e=t.length;for(;--e>=0&&t.item(e)!==this;);return e>-1});Element.prototype.closest||(Element.prototype.closest=function(s){let t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(s))return t;t=t.parentElement||t.parentNode}while(t!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(s){const t=document.createDocumentFragment();Array.isArray(s)||(s=[s]),s.forEach(e=>{const o=e instanceof Node;t.appendChild(o?e:document.createTextNode(e))}),this.insertBefore(t,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(s){s=arguments.length===0?!0:!!s;const t=this.parentNode,e=window.getComputedStyle(t,null),o=parseInt(e.getPropertyValue("border-top-width")),i=parseInt(e.getPropertyValue("border-left-width")),n=this.offsetTop-t.offsetTop<t.scrollTop,r=this.offsetTop-t.offsetTop+this.clientHeight-o>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,l=this.offsetLeft-t.offsetLeft+this.clientWidth-i>t.scrollLeft+t.clientWidth,c=n&&!r;(n||r)&&s&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-o+this.clientHeight/2),(a||l)&&s&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-i+this.clientWidth/2),(n||r||a||l)&&!s&&this.scrollIntoView(c)});let He=(s=21)=>crypto.getRandomValues(new Uint8Array(s)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");var oe=(s=>(s.VERBOSE="VERBOSE",s.INFO="INFO",s.WARN="WARN",s.ERROR="ERROR",s))(oe||{});const E={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91},je={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function gt(s,t,e="log",o,i="color: inherit"){if(!("console"in window)||!window.console[e])return;const n=["info","log","warn","error"].includes(e),r=[];switch(gt.logLevel){case"ERROR":if(e!=="error")return;break;case"WARN":if(!["error","warn"].includes(e))return;break;case"INFO":if(!n||s)return;break}o&&r.push(o);const a="Editor.js 2.27.2",l=`line-height: 1em; import{_ as Le,$ as Zt,c as Oe,h as Ne,r as Re,o as De,g as Pe}from"./admin-app-aba5adce.js";import"./index-8746c87e.js";var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function St(){}Object.assign(St,{default:St,register:St,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){const t=(this.document||this.ownerDocument).querySelectorAll(s);let e=t.length;for(;--e>=0&&t.item(e)!==this;);return e>-1});Element.prototype.closest||(Element.prototype.closest=function(s){let t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(s))return t;t=t.parentElement||t.parentNode}while(t!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(s){const t=document.createDocumentFragment();Array.isArray(s)||(s=[s]),s.forEach(e=>{const o=e instanceof Node;t.appendChild(o?e:document.createTextNode(e))}),this.insertBefore(t,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(s){s=arguments.length===0?!0:!!s;const t=this.parentNode,e=window.getComputedStyle(t,null),o=parseInt(e.getPropertyValue("border-top-width")),i=parseInt(e.getPropertyValue("border-left-width")),n=this.offsetTop-t.offsetTop<t.scrollTop,r=this.offsetTop-t.offsetTop+this.clientHeight-o>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,l=this.offsetLeft-t.offsetLeft+this.clientWidth-i>t.scrollLeft+t.clientWidth,c=n&&!r;(n||r)&&s&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-o+this.clientHeight/2),(a||l)&&s&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-i+this.clientWidth/2),(n||r||a||l)&&!s&&this.scrollIntoView(c)});let He=(s=21)=>crypto.getRandomValues(new Uint8Array(s)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");var oe=(s=>(s.VERBOSE="VERBOSE",s.INFO="INFO",s.WARN="WARN",s.ERROR="ERROR",s))(oe||{});const E={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91},je={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function gt(s,t,e="log",o,i="color: inherit"){if(!("console"in window)||!window.console[e])return;const n=["info","log","warn","error"].includes(e),r=[];switch(gt.logLevel){case"ERROR":if(e!=="error")return;break;case"WARN":if(!["error","warn"].includes(e))return;break;case"INFO":if(!n||s)return;break}o&&r.push(o);const a="Editor.js 2.27.2",l=`line-height: 1em;
color: #006FEA; color: #006FEA;
display: inline-block; display: inline-block;
font-size: 11px; font-size: 11px;
@@ -80,4 +80,4 @@ import{_ as Le,u as Zt,x as Oe,c as Ne,y as Re,z as De,o as Pe}from"./admin-app-
* @license Apache-2.0 * @license Apache-2.0
* @see Editor.js <https://editorjs.io> * @see Editor.js <https://editorjs.io>
* @author CodeX Team <https://codex.so> * @author CodeX Team <https://codex.so>
*/class yi{static get version(){return"2.27.2"}constructor(t){let e=()=>{};z(t)&&D(t.onReady)&&(e=t.onReady);const o=new wi(t);this.isReady=o.isReady.then(()=>{this.exportAPI(o),e()})}exportAPI(t){const e=["configuration"],o=()=>{Object.values(t.moduleInstances).forEach(i=>{D(i.destroy)&&i.destroy(),i.listeners.removeAll()}),t=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};e.forEach(i=>{this[i]=t[i]}),this.destroy=o,Object.setPrototypeOf(this,t.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,n])=>{Object.entries(n).forEach(([r,a])=>{this[a]=t.moduleInstances.API.methods[i][r]})})}}const Tt={header:Zt(()=>import("./bundle-2e44dd63.js").then(s=>s.b),["assets/bundle-2e44dd63.js","assets/admin-app-be7eed0b.js","assets/index-8746c87e.js","assets/admin-app-935fc652.css"]),list:Zt(()=>import("./bundle-8d671c97.js").then(s=>s.b),["assets/bundle-8d671c97.js","assets/admin-app-be7eed0b.js","assets/index-8746c87e.js","assets/admin-app-935fc652.css"])},Ei=Oe({name:"vue-editor-js",props:{holder:{type:String,default:()=>"vue-editor-js",require:!0},config:{type:Object,default:()=>({}),require:!0},initialized:{type:Function,default:()=>{}}},setup:(s,t)=>{const e=Re({editor:null});function o(r){i(),e.editor=new yi({holder:r.holder||"vue-editor-js",...r.config,onChange:(a,l)=>{n()}}),r.initialized(e.editor)}function i(){e.editor&&(e.editor.destroy(),e.editor=null)}function n(){console.log("saveEditor"),e.editor&&e.editor.save().then(r=>{console.log(r),t.emit("saved",r)})}return De(r=>o(s)),{props:s,state:e}},methods:{useTools(s,t){const e=Object.keys(Tt),o={...s.customTools};return e.every(i=>!s[i])?(e.forEach(i=>o[i]={class:Tt[i]}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o):(e.forEach(i=>{const n=s[i];if(n&&(o[i]={class:Tt[i]},typeof n=="object")){const r=Object.assign({},s[i]);delete r.class,o[i]=Object.assign(o[i],r)}}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o)}}}),Si=["id"];function Ci(s,t,e,o,i,n){return Pe(),Ne("div",{id:s.holder},null,8,Si)}const Ii=Le(Ei,[["render",Ci]]);export{Tt as PLUGINS,Ii as default}; */class yi{static get version(){return"2.27.2"}constructor(t){let e=()=>{};z(t)&&D(t.onReady)&&(e=t.onReady);const o=new wi(t);this.isReady=o.isReady.then(()=>{this.exportAPI(o),e()})}exportAPI(t){const e=["configuration"],o=()=>{Object.values(t.moduleInstances).forEach(i=>{D(i.destroy)&&i.destroy(),i.listeners.removeAll()}),t=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};e.forEach(i=>{this[i]=t[i]}),this.destroy=o,Object.setPrototypeOf(this,t.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,n])=>{Object.entries(n).forEach(([r,a])=>{this[a]=t.moduleInstances.API.methods[i][r]})})}}const Tt={header:Zt(()=>import("./bundle-8cd2c944.js").then(s=>s.b),["assets/bundle-8cd2c944.js","assets/admin-app-aba5adce.js","assets/index-8746c87e.js","assets/admin-app-935fc652.css"]),list:Zt(()=>import("./bundle-afbdc531.js").then(s=>s.b),["assets/bundle-afbdc531.js","assets/admin-app-aba5adce.js","assets/index-8746c87e.js","assets/admin-app-935fc652.css"])},Ei=Oe({name:"vue-editor-js",props:{holder:{type:String,default:()=>"vue-editor-js",require:!0},config:{type:Object,default:()=>({}),require:!0},initialized:{type:Function,default:()=>{}}},setup:(s,t)=>{const e=Re({editor:null});function o(r){i(),e.editor=new yi({holder:r.holder||"vue-editor-js",...r.config,onChange:(a,l)=>{n()}}),r.initialized(e.editor)}function i(){e.editor&&(e.editor.destroy(),e.editor=null)}function n(){console.log("saveEditor"),e.editor&&e.editor.save().then(r=>{console.log(r),t.emit("saved",r)})}return De(r=>o(s)),{props:s,state:e}},methods:{useTools(s,t){const e=Object.keys(Tt),o={...s.customTools};return e.every(i=>!s[i])?(e.forEach(i=>o[i]={class:Tt[i]}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o):(e.forEach(i=>{const n=s[i];if(n&&(o[i]={class:Tt[i]},typeof n=="object")){const r=Object.assign({},s[i]);delete r.class,o[i]=Object.assign(o[i],r)}}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o)}}}),Si=["id"];function Ci(s,t,e,o,i,n){return Pe(),Ne("div",{id:s.holder},null,8,Si)}const Ii=Le(Ei,[["render",Ci]]);export{Tt as PLUGINS,Ii as default};

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -1,4 +1,4 @@
import{A as E}from"./admin-app-be7eed0b.js";function P(_,j){for(var v=0;v<j.length;v++){const p=j[v];if(typeof p!="string"&&!Array.isArray(p)){for(const c in p)if(c!=="default"&&!(c in _)){const o=Object.getOwnPropertyDescriptor(p,c);o&&Object.defineProperty(_,c,o.get?o:{enumerable:!0,get:()=>p[c]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}var T={exports:{}};(function(_,j){(function(v,p){_.exports=p()})(window,function(){return function(v){var p={};function c(o){if(p[o])return p[o].exports;var l=p[o]={i:o,l:!1,exports:{}};return v[o].call(l.exports,l,l.exports,c),l.l=!0,l.exports}return c.m=v,c.c=p,c.d=function(o,l,d){c.o(o,l)||Object.defineProperty(o,l,{enumerable:!0,get:d})},c.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},c.t=function(o,l){if(1&l&&(o=c(o)),8&l||4&l&&typeof o=="object"&&o&&o.__esModule)return o;var d=Object.create(null);if(c.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:o}),2&l&&typeof o!="string")for(var f in o)c.d(d,f,(function(b){return o[b]}).bind(null,f));return d},c.n=function(o){var l=o&&o.__esModule?function(){return o.default}:function(){return o};return c.d(l,"a",l),l},c.o=function(o,l){return Object.prototype.hasOwnProperty.call(o,l)},c.p="/",c(c.s=4)}([function(v,p,c){var o=c(1),l=c(2);typeof(l=l.__esModule?l.default:l)=="string"&&(l=[[v.i,l,""]]);var d={insert:"head",singleton:!1};o(l,d),v.exports=l.locals||{}},function(v,p,c){var o,l=function(){return o===void 0&&(o=!!(window&&document&&document.all&&!window.atob)),o},d=function(){var r={};return function(i){if(r[i]===void 0){var s=document.querySelector(i);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch{s=null}r[i]=s}return r[i]}}(),f=[];function b(r){for(var i=-1,s=0;s<f.length;s++)if(f[s].identifier===r){i=s;break}return i}function S(r,i){for(var s={},u=[],m=0;m<r.length;m++){var g=r[m],y=i.base?g[0]+i.base:g[0],C=s[y]||0,O="".concat(y," ").concat(C);s[y]=C+1;var L=b(O),M={css:g[1],media:g[2],sourceMap:g[3]};L!==-1?(f[L].references++,f[L].updater(M)):f.push({identifier:O,updater:h(M,i),references:1}),u.push(O)}return u}function k(r){var i=document.createElement("style"),s=r.attributes||{};if(s.nonce===void 0){var u=c.nc;u&&(s.nonce=u)}if(Object.keys(s).forEach(function(g){i.setAttribute(g,s[g])}),typeof r.insert=="function")r.insert(i);else{var m=d(r.insert||"head");if(!m)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");m.appendChild(i)}return i}var w,x=(w=[],function(r,i){return w[r]=i,w.filter(Boolean).join(` import{a0 as E}from"./admin-app-aba5adce.js";function P(_,j){for(var v=0;v<j.length;v++){const p=j[v];if(typeof p!="string"&&!Array.isArray(p)){for(const c in p)if(c!=="default"&&!(c in _)){const o=Object.getOwnPropertyDescriptor(p,c);o&&Object.defineProperty(_,c,o.get?o:{enumerable:!0,get:()=>p[c]})}}}return Object.freeze(Object.defineProperty(_,Symbol.toStringTag,{value:"Module"}))}var T={exports:{}};(function(_,j){(function(v,p){_.exports=p()})(window,function(){return function(v){var p={};function c(o){if(p[o])return p[o].exports;var l=p[o]={i:o,l:!1,exports:{}};return v[o].call(l.exports,l,l.exports,c),l.l=!0,l.exports}return c.m=v,c.c=p,c.d=function(o,l,d){c.o(o,l)||Object.defineProperty(o,l,{enumerable:!0,get:d})},c.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},c.t=function(o,l){if(1&l&&(o=c(o)),8&l||4&l&&typeof o=="object"&&o&&o.__esModule)return o;var d=Object.create(null);if(c.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:o}),2&l&&typeof o!="string")for(var f in o)c.d(d,f,(function(b){return o[b]}).bind(null,f));return d},c.n=function(o){var l=o&&o.__esModule?function(){return o.default}:function(){return o};return c.d(l,"a",l),l},c.o=function(o,l){return Object.prototype.hasOwnProperty.call(o,l)},c.p="/",c(c.s=4)}([function(v,p,c){var o=c(1),l=c(2);typeof(l=l.__esModule?l.default:l)=="string"&&(l=[[v.i,l,""]]);var d={insert:"head",singleton:!1};o(l,d),v.exports=l.locals||{}},function(v,p,c){var o,l=function(){return o===void 0&&(o=!!(window&&document&&document.all&&!window.atob)),o},d=function(){var r={};return function(i){if(r[i]===void 0){var s=document.querySelector(i);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch{s=null}r[i]=s}return r[i]}}(),f=[];function b(r){for(var i=-1,s=0;s<f.length;s++)if(f[s].identifier===r){i=s;break}return i}function S(r,i){for(var s={},u=[],m=0;m<r.length;m++){var g=r[m],y=i.base?g[0]+i.base:g[0],C=s[y]||0,O="".concat(y," ").concat(C);s[y]=C+1;var L=b(O),M={css:g[1],media:g[2],sourceMap:g[3]};L!==-1?(f[L].references++,f[L].updater(M)):f.push({identifier:O,updater:h(M,i),references:1}),u.push(O)}return u}function k(r){var i=document.createElement("style"),s=r.attributes||{};if(s.nonce===void 0){var u=c.nc;u&&(s.nonce=u)}if(Object.keys(s).forEach(function(g){i.setAttribute(g,s[g])}),typeof r.insert=="function")r.insert(i);else{var m=d(r.insert||"head");if(!m)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");m.appendChild(i)}return i}var w,x=(w=[],function(r,i){return w[r]=i,w.filter(Boolean).join(`
`)});function a(r,i,s,u){var m=s?"":u.media?"@media ".concat(u.media," {").concat(u.css,"}"):u.css;if(r.styleSheet)r.styleSheet.cssText=x(i,m);else{var g=document.createTextNode(m),y=r.childNodes;y[i]&&r.removeChild(y[i]),y.length?r.insertBefore(g,y[i]):r.appendChild(g)}}function e(r,i,s){var u=s.css,m=s.media,g=s.sourceMap;if(m?r.setAttribute("media",m):r.removeAttribute("media"),g&&btoa&&(u+=` `)});function a(r,i,s,u){var m=s?"":u.media?"@media ".concat(u.media," {").concat(u.css,"}"):u.css;if(r.styleSheet)r.styleSheet.cssText=x(i,m);else{var g=document.createTextNode(m),y=r.childNodes;y[i]&&r.removeChild(y[i]),y.length?r.insertBefore(g,y[i]):r.appendChild(g)}}function e(r,i,s){var u=s.css,m=s.media,g=s.sourceMap;if(m?r.setAttribute("media",m):r.removeAttribute("media"),g&&btoa&&(u+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(g))))," */")),r.styleSheet)r.styleSheet.cssText=u;else{for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(document.createTextNode(u))}}var t=null,n=0;function h(r,i){var s,u,m;if(i.singleton){var g=n++;s=t||(t=k(i)),u=a.bind(null,s,g,!1),m=a.bind(null,s,g,!0)}else s=k(i),u=e.bind(null,s,i),m=function(){(function(y){if(y.parentNode===null)return!1;y.parentNode.removeChild(y)})(s)};return u(r),function(y){if(y){if(y.css===r.css&&y.media===r.media&&y.sourceMap===r.sourceMap)return;u(r=y)}else m()}}v.exports=function(r,i){(i=i||{}).singleton||typeof i.singleton=="boolean"||(i.singleton=l());var s=S(r=r||[],i);return function(u){if(u=u||[],Object.prototype.toString.call(u)==="[object Array]"){for(var m=0;m<s.length;m++){var g=b(s[m]);f[g].references--}for(var y=S(u,i),C=0;C<s.length;C++){var O=b(s[C]);f[O].references===0&&(f[O].updater(),f.splice(O,1))}s=y}}}},function(v,p,c){(p=c(3)(!1)).push([v.i,`.cdx-list { /*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(g))))," */")),r.styleSheet)r.styleSheet.cssText=u;else{for(;r.firstChild;)r.removeChild(r.firstChild);r.appendChild(document.createTextNode(u))}}var t=null,n=0;function h(r,i){var s,u,m;if(i.singleton){var g=n++;s=t||(t=k(i)),u=a.bind(null,s,g,!1),m=a.bind(null,s,g,!0)}else s=k(i),u=e.bind(null,s,i),m=function(){(function(y){if(y.parentNode===null)return!1;y.parentNode.removeChild(y)})(s)};return u(r),function(y){if(y){if(y.css===r.css&&y.media===r.media&&y.sourceMap===r.sourceMap)return;u(r=y)}else m()}}v.exports=function(r,i){(i=i||{}).singleton||typeof i.singleton=="boolean"||(i.singleton=l());var s=S(r=r||[],i);return function(u){if(u=u||[],Object.prototype.toString.call(u)==="[object Array]"){for(var m=0;m<s.length;m++){var g=b(s[m]);f[g].references--}for(var y=S(u,i),C=0;C<s.length;C++){var O=b(s[C]);f[O].references===0&&(f[O].updater(),f.splice(O,1))}s=y}}}},function(v,p,c){(p=c(3)(!1)).push([v.i,`.cdx-list {
margin: 0; margin: 0;

Binary file not shown.

View File

@@ -3,25 +3,25 @@
"file": "assets/NativeImageBlock-e3b0c442.css", "file": "assets/NativeImageBlock-e3b0c442.css",
"src": "NativeImageBlock.css" "src": "NativeImageBlock.css"
}, },
"_NativeImageBlock-041f164b.js": { "_NativeImageBlock-312132c4.js": {
"css": [ "css": [
"assets/NativeImageBlock-e3b0c442.css" "assets/NativeImageBlock-e3b0c442.css"
], ],
"file": "assets/NativeImageBlock-041f164b.js", "file": "assets/NativeImageBlock-312132c4.js",
"imports": [ "imports": [
"resources/js/admin-app.js" "resources/js/admin-app.js"
], ],
"isDynamicEntry": true "isDynamicEntry": true
}, },
"_bundle-2e44dd63.js": { "_bundle-8cd2c944.js": {
"file": "assets/bundle-2e44dd63.js", "file": "assets/bundle-8cd2c944.js",
"imports": [ "imports": [
"resources/js/admin-app.js" "resources/js/admin-app.js"
], ],
"isDynamicEntry": true "isDynamicEntry": true
}, },
"_bundle-8d671c97.js": { "_bundle-afbdc531.js": {
"file": "assets/bundle-8d671c97.js", "file": "assets/bundle-afbdc531.js",
"imports": [ "imports": [
"resources/js/admin-app.js" "resources/js/admin-app.js"
], ],
@@ -47,11 +47,11 @@
"assets/admin-app-935fc652.css" "assets/admin-app-935fc652.css"
], ],
"dynamicImports": [ "dynamicImports": [
"_NativeImageBlock-041f164b.js", "_NativeImageBlock-312132c4.js",
"resources/js/vue/PostEditor.vue", "resources/js/vue/PostEditor.vue",
"resources/js/vue/VueEditorJs.vue" "resources/js/vue/VueEditorJs.vue"
], ],
"file": "assets/admin-app-be7eed0b.js", "file": "assets/admin-app-aba5adce.js",
"imports": [ "imports": [
"_index-8746c87e.js" "_index-8746c87e.js"
], ],
@@ -66,13 +66,20 @@
"isEntry": true, "isEntry": true,
"src": "resources/js/front-app.js" "src": "resources/js/front-app.js"
}, },
"resources/js/vue/PostEditor.css": {
"file": "assets/PostEditor-8d534a4a.css",
"src": "resources/js/vue/PostEditor.css"
},
"resources/js/vue/PostEditor.vue": { "resources/js/vue/PostEditor.vue": {
"file": "assets/PostEditor-986ca08b.js", "css": [
"assets/PostEditor-8d534a4a.css"
],
"file": "assets/PostEditor-1ec3f907.js",
"imports": [ "imports": [
"resources/js/vue/VueEditorJs.vue", "resources/js/vue/VueEditorJs.vue",
"_NativeImageBlock-041f164b.js", "_NativeImageBlock-312132c4.js",
"_bundle-8d671c97.js", "_bundle-afbdc531.js",
"_bundle-2e44dd63.js", "_bundle-8cd2c944.js",
"resources/js/admin-app.js", "resources/js/admin-app.js",
"_index-8746c87e.js" "_index-8746c87e.js"
], ],
@@ -81,10 +88,10 @@
}, },
"resources/js/vue/VueEditorJs.vue": { "resources/js/vue/VueEditorJs.vue": {
"dynamicImports": [ "dynamicImports": [
"_bundle-2e44dd63.js", "_bundle-8cd2c944.js",
"_bundle-8d671c97.js" "_bundle-afbdc531.js"
], ],
"file": "assets/VueEditorJs-4387d219.js", "file": "assets/VueEditorJs-a5519440.js",
"imports": [ "imports": [
"resources/js/admin-app.js", "resources/js/admin-app.js",
"_index-8746c87e.js" "_index-8746c87e.js"

Binary file not shown.

View File

@@ -90,13 +90,10 @@
<path d="M12 15v3"></path> <path d="M12 15v3"></path>
</svg> </svg>
</span> </span>
<input <VueDatePicker
type="date" :timezone="timezone"
v-model="post.publish_date" v-model="post.publish_date"
class="form-control" ></VueDatePicker>
placeholder="Select a date"
id="datepicker-icon-prepend"
/>
</div> </div>
<button <button
@click="checkAndSave" @click="checkAndSave"
@@ -198,13 +195,22 @@ import { usePostStore } from "@/stores/postStore.js";
import axios from "axios"; import axios from "axios";
import route from "ziggy-js/src/js/index"; import route from "ziggy-js/src/js/index";
import VueDatePicker from "@vuepic/vue-datepicker";
import "@vuepic/vue-datepicker/dist/main.css";
import { addMinutes } from "date-fns";
export default { export default {
components: { VueEditorJs, List, Header }, components: { VueEditorJs, List, Header, VueDatePicker },
props: { props: {
postId: { postId: {
type: Number, // The prop type is Number type: Number, // The prop type is Number
default: null, // Default value if the prop is not provided default: null, // Default value if the prop is not provided
}, },
timezone: {
type: String,
default: null,
},
}, },
data() { data() {
return { return {
@@ -302,7 +308,7 @@ export default {
errors.push("post title"); errors.push("post title");
} }
if (!(this.post.publish_date?.length > 0)) { if (!(this.post.publish_date != null)) {
errors.push("publish date"); errors.push("publish date");
} }
@@ -348,6 +354,15 @@ export default {
if (_item != null) { if (_item != null) {
if (key == "body") { if (key == "body") {
formData.append(key, JSON.stringify(_item)); formData.append(key, JSON.stringify(_item));
} else if (key == "publish_date") {
if (_item instanceof Date) {
// Now utcDate is the equivalent UTC date of your original date
let isoDate = _item.toISOString();
formData.append(key, isoDate);
} else {
formData.append(key, _item);
}
} else { } else {
formData.append(key, _item); formData.append(key, _item);
} }
@@ -362,6 +377,9 @@ export default {
}) })
.then((response) => { .then((response) => {
console.warn(response); console.warn(response);
if (response.data.action == "redirect_back") {
history.back();
}
}); });
setTimeout( setTimeout(

View File

@@ -1,4 +1,4 @@
const Ziggy = {"url":"https:\/\/productalert.co","port":null,"defaults":{},"routes":{"debugbar.openhandler":{"uri":"_debugbar\/open","methods":["GET","HEAD"]},"debugbar.clockwork":{"uri":"_debugbar\/clockwork\/{id}","methods":["GET","HEAD"]},"debugbar.assets.css":{"uri":"_debugbar\/assets\/stylesheets","methods":["GET","HEAD"]},"debugbar.assets.js":{"uri":"_debugbar\/assets\/javascript","methods":["GET","HEAD"]},"debugbar.cache.delete":{"uri":"_debugbar\/cache\/{key}\/{tags?}","methods":["DELETE"]},"sanctum.csrf-cookie":{"uri":"sanctum\/csrf-cookie","methods":["GET","HEAD"]},"ignition.healthCheck":{"uri":"_ignition\/health-check","methods":["GET","HEAD"]},"ignition.executeSolution":{"uri":"_ignition\/execute-solution","methods":["POST"]},"ignition.updateConfig":{"uri":"_ignition\/update-config","methods":["POST"]},"api.auth.login.post":{"uri":"api\/login","methods":["POST"]},"api.auth.logout.post":{"uri":"api\/logout","methods":["POST"]},"api.admin.post.get":{"uri":"api\/admin\/post\/{id}","methods":["GET","HEAD"]},"api.admin.country-locales":{"uri":"api\/admin\/country-locales","methods":["GET","HEAD"]},"api.admin.categories":{"uri":"api\/admin\/categories\/{country_locale_slug}","methods":["GET","HEAD"]},"api.admin.authors":{"uri":"api\/admin\/authors","methods":["GET","HEAD"]},"api.admin.upload.cloud.image":{"uri":"api\/admin\/image\/upload","methods":["POST"]},"api.admin.post.upsert":{"uri":"api\/admin\/admin\/post\/upsert","methods":["POST"]},"login":{"uri":"login","methods":["GET","HEAD"]},"logout":{"uri":"logout","methods":["POST"]},"register":{"uri":"register","methods":["GET","HEAD"]},"password.request":{"uri":"password\/reset","methods":["GET","HEAD"]},"password.email":{"uri":"password\/email","methods":["POST"]},"password.reset":{"uri":"password\/reset\/{token}","methods":["GET","HEAD"]},"password.update":{"uri":"password\/reset","methods":["POST"]},"password.confirm":{"uri":"password\/confirm","methods":["GET","HEAD"]},"dashboard":{"uri":"admin","methods":["GET","HEAD"]},"about":{"uri":"admin\/about","methods":["GET","HEAD"]},"users.index":{"uri":"admin\/users","methods":["GET","HEAD"]},"posts.manage":{"uri":"admin\/posts","methods":["GET","HEAD"]},"posts.manage.edit":{"uri":"admin\/posts\/edit\/{post_id}","methods":["GET","HEAD"]},"posts.manage.new":{"uri":"admin\/posts\/new","methods":["GET","HEAD"]},"profile.show":{"uri":"admin\/profile","methods":["GET","HEAD"]},"profile.update":{"uri":"admin\/profile","methods":["PUT"]},"home":{"uri":"\/","methods":["GET","HEAD"]},"home.country":{"uri":"{country}","methods":["GET","HEAD"]},"home.country.posts":{"uri":"{country}\/posts","methods":["GET","HEAD"]},"home.country.post":{"uri":"{country}\/posts\/{post_slug}","methods":["GET","HEAD"]},"home.country.category":{"uri":"{country}\/{category}","methods":["GET","HEAD"]}}}; const Ziggy = {"url":"https:\/\/productalert.co","port":null,"defaults":{},"routes":{"debugbar.openhandler":{"uri":"_debugbar\/open","methods":["GET","HEAD"]},"debugbar.clockwork":{"uri":"_debugbar\/clockwork\/{id}","methods":["GET","HEAD"]},"debugbar.assets.css":{"uri":"_debugbar\/assets\/stylesheets","methods":["GET","HEAD"]},"debugbar.assets.js":{"uri":"_debugbar\/assets\/javascript","methods":["GET","HEAD"]},"debugbar.cache.delete":{"uri":"_debugbar\/cache\/{key}\/{tags?}","methods":["DELETE"]},"sanctum.csrf-cookie":{"uri":"sanctum\/csrf-cookie","methods":["GET","HEAD"]},"ignition.healthCheck":{"uri":"_ignition\/health-check","methods":["GET","HEAD"]},"ignition.executeSolution":{"uri":"_ignition\/execute-solution","methods":["POST"]},"ignition.updateConfig":{"uri":"_ignition\/update-config","methods":["POST"]},"api.auth.login.post":{"uri":"api\/login","methods":["POST"]},"api.auth.logout.post":{"uri":"api\/logout","methods":["POST"]},"api.admin.post.get":{"uri":"api\/admin\/post\/{id}","methods":["GET","HEAD"]},"api.admin.country-locales":{"uri":"api\/admin\/country-locales","methods":["GET","HEAD"]},"api.admin.categories":{"uri":"api\/admin\/categories\/{country_locale_slug}","methods":["GET","HEAD"]},"api.admin.authors":{"uri":"api\/admin\/authors","methods":["GET","HEAD"]},"api.admin.upload.cloud.image":{"uri":"api\/admin\/image\/upload","methods":["POST"]},"api.admin.post.upsert":{"uri":"api\/admin\/admin\/post\/upsert","methods":["POST"]},"feeds.main":{"uri":"posts.rss","methods":["GET","HEAD"]},"login":{"uri":"login","methods":["GET","HEAD"]},"logout":{"uri":"logout","methods":["POST"]},"register":{"uri":"register","methods":["GET","HEAD"]},"password.request":{"uri":"password\/reset","methods":["GET","HEAD"]},"password.email":{"uri":"password\/email","methods":["POST"]},"password.reset":{"uri":"password\/reset\/{token}","methods":["GET","HEAD"]},"password.update":{"uri":"password\/reset","methods":["POST"]},"password.confirm":{"uri":"password\/confirm","methods":["GET","HEAD"]},"dashboard":{"uri":"admin","methods":["GET","HEAD"]},"about":{"uri":"admin\/about","methods":["GET","HEAD"]},"users.index":{"uri":"admin\/users","methods":["GET","HEAD"]},"posts.manage":{"uri":"admin\/posts","methods":["GET","HEAD"]},"posts.manage.edit":{"uri":"admin\/posts\/edit\/{post_id}","methods":["GET","HEAD"]},"posts.manage.new":{"uri":"admin\/posts\/new","methods":["GET","HEAD"]},"profile.show":{"uri":"admin\/profile","methods":["GET","HEAD"]},"profile.update":{"uri":"admin\/profile","methods":["PUT"]},"home":{"uri":"\/","methods":["GET","HEAD"]},"home.country":{"uri":"{country}","methods":["GET","HEAD"]},"home.country.posts":{"uri":"{country}\/posts","methods":["GET","HEAD"]},"home.country.post":{"uri":"{country}\/posts\/{post_slug}","methods":["GET","HEAD"]},"home.country.category":{"uri":"{country}\/{category}","methods":["GET","HEAD"]}}};
if (typeof window !== 'undefined' && typeof window.Ziggy !== 'undefined') { if (typeof window !== 'undefined' && typeof window.Ziggy !== 'undefined') {
Object.assign(Ziggy.routes, window.Ziggy.routes); Object.assign(Ziggy.routes, window.Ziggy.routes);

View File

@@ -42,32 +42,38 @@
<td><img width="80" height="60" src="{{ $post->featured_image }}" <td><img width="80" height="60" src="{{ $post->featured_image }}"
class="img-fluid rounded-2" alt=""></td> class="img-fluid rounded-2" alt=""></td>
<td> <td>
@if($post->status === 'publish') @if ($post->status === 'publish')
<span class="badge bg-success">{{ ucfirst($post->status) }}</span> <span class="badge bg-success">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'future') @elseif($post->status === 'future')
<span class="badge bg-primary">{{ ucfirst($post->status) }}</span> <span class="badge bg-primary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'draft') @elseif($post->status === 'draft')
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span> <span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'private') @elseif($post->status === 'private')
<span class="badge bg-info">{{ ucfirst($post->status) }}</span> <span class="badge bg-info">{{ ucfirst($post->status) }}</span>
@elseif ($post->status == 'trash') @elseif ($post->status == 'trash')
<span class="badge bg-danger">{{ ucfirst($post->status) }}</span> <span class="badge bg-danger">{{ ucfirst($post->status) }}</span>
@else @else
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span> <span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@endif @endif
</td> </td>
<td> <td>
@if(!is_empty($post->post_category?->category?->country_locale_slug) && $post->status == 'publish') @if (!is_empty($post->post_category?->category?->country_locale_slug) && $post->status == 'publish')
<a <a
href="{{ route('home.country.post', ['country' => $post->post_category?->category?->country_locale_slug, 'post_slug' => $post->slug]) }}">{{ $post->title }}</a> href="{{ route('home.country.post', ['country' => $post->post_category?->category?->country_locale_slug, 'post_slug' => $post->slug]) }}">{{ $post->title }}</a>
@else @else
{{ $post->title }} {{ $post->title }}
@endif @endif
</td> </td>
<td> <td>
Created at {{ $post->created_at->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}<br> Created at
Updated {{ $post->updated_at->diffForhumans() }} {{ $post->created_at->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}<br>
Updated {{ $post->updated_at->diffForhumans() }}<br>
@if ($post->status == 'publish')
Published at
{{ $post->publish_date->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}
@endif
</td> </td>
<td> <td>
<div><a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}" <div><a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}"

View File

@@ -5,23 +5,23 @@
<!-- Page title --> <!-- Page title -->
<div class="page-header d-print-none"> <div class="page-header d-print-none">
<h2 class="page-title text-center justify-content-center"> <h2 class="page-title text-center justify-content-center">
<div class="align-self-center"> <div class="align-self-center">
@if (!is_null($post)) @if (!is_null($post))
Edit Post Edit Post
@else @else
New Post New Post
@endif @endif
</div> </div>
</h2> </h2>
</div> </div>
</div> </div>
<div class="page-body"> <div class="page-body">
<div class="container-xl"> <div class="container-xl">
@if (!is_null($post)) @if (!is_null($post))
<post-editor :post-id="{{ $post->id }}"></post-editor> <post-editor :post-id="{{ $post->id }}"></post-editor>
@else @else
<post-editor></post-editor> <post-editor timezone="{{ session()->get('timezone') }}"></post-editor>
@endif @endif
</div> </div>
</div> </div>
@endsection @endsection

View File

@@ -22,13 +22,14 @@
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}" <a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"
class="text-decoration-none"> class="text-decoration-none">
<div class="card-img-top ratio ratio-16x9"> <div class="card-img-top ratio ratio-16x9">
<div class="lqip-loader"> <div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL --> <!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}"> <img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL --> <!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}"> <img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
</div> alt="Placeholder image of {{ $post->name }}">
</div>
</div> </div>
</a> </a>
@@ -85,13 +86,15 @@ class="text-decoration-none">{{ $post->title }}</a>
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}" <a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"
class="text-decoration-none"> class="text-decoration-none">
<div class="img-fluid rounded-start ratio ratio-16x9"> <div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader"> <div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL --> <!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}"> <img src="{{ $post->featured_image }}"
alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}"> <!-- Use the final JPEG image with the appropriate URL -->
</div> <img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div> </div>
</a> </a>
</div> </div>

View File

@@ -44,15 +44,16 @@
</div> </div>
<a class="card-img-top" <a class="card-img-top"
href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"> href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}">
<div class="img-fluid rounded-start ratio ratio-16x9"> <div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader"> <div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL --> <!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}"> <img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL --> <!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}"> <img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
</div> alt="Placeholder image of {{ $post->name }}">
</div> </div>
</div>
</a> </a>
</div> </div>

View File

@@ -43,15 +43,16 @@
</div> </div>
<a class="card-img-top" <a class="card-img-top"
href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"> href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}">
<div class="img-fluid rounded-start ratio ratio-16x9"> <div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader"> <div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL --> <!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}"> <img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL --> <!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}"> <img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
</div> alt="Placeholder image of {{ $post->name }}">
</div> </div>
</div>
</a> </a>
</div> </div>

View File

@@ -21,7 +21,13 @@
<span class="ms-2"> <span class="ms-2">
<small> <small>
Written by {{ $post->author->name }} {{ $post->author->name }}
</small>
</span>
<span class="ms-2">
<small>
{{ $post->publish_date->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}
</small> </small>
</span> </span>
</div> </div>
@@ -31,15 +37,17 @@
<h2 class="h5">{{ $post->excerpt }}</h2> <h2 class="h5">{{ $post->excerpt }}</h2>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<div class="img-fluid rounded-start ratio ratio-16x9"> <div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader"> <div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL --> <!-- Use the LQIP image with the appropriate URL -->
<img class="img-fluid rounded-2" src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}"> <img class="img-fluid rounded-2" src="{{ $post->featured_image }}"
alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen img-fluid rounded-2" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}"> <!-- Use the final JPEG image with the appropriate URL -->
</div> <img class="lqip-frozen img-fluid rounded-2" src="{{ $post->featured_image_lqip }}"
</div> alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
{!! $post->html_body !!} {!! $post->html_body !!}

View File

@@ -2,15 +2,15 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head> <head>
@include('googletagmanager::head') @include('googletagmanager::head')
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{!! SEOMeta::generate() !!} {!! SEOMeta::generate() !!}
{!! OpenGraph::generate() !!} {!! OpenGraph::generate() !!}
{!! Twitter::generate() !!} {!! Twitter::generate() !!}
{!! JsonLdMulti::generate() !!} {!! JsonLdMulti::generate() !!}
<meta property="fb:app_id" content="{{ config('seotools.fb_app_id') }}" /> <meta property="fb:app_id" content="{{ config('seotools.fb_app_id') }}" />
@vite('resources/sass/front-app.scss') @vite('resources/sass/front-app.scss')

View File

@@ -4,26 +4,26 @@
<div class="col-6 col-md-2 mb-3"> <div class="col-6 col-md-2 mb-3">
<ul class="nav flex-column"> <ul class="nav flex-column">
@foreach ($categories as $category) @foreach ($categories as $category)
@if ($category->id % 2 == 0) @if ($category->id % 2 == 0)
<li class="nav-item mb-2"> <li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary" <a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a> href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li> </li>
@endif @endif
@endforeach @endforeach
</ul> </ul>
</div> </div>
<div class="col-6 col-md-2 mb-3"> <div class="col-6 col-md-2 mb-3">
<ul class="nav flex-column"> <ul class="nav flex-column">
@foreach ($categories as $category) @foreach ($categories as $category)
@if ($category->id % 2 == 1) @if ($category->id % 2 == 1)
<li class="nav-item mb-2"> <li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary" <a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a> href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li> </li>
@endif @endif
@endforeach @endforeach
</ul> </ul>
</div> </div>
@@ -51,7 +51,7 @@
</div> </div>
@endif @endif
{{-- <form> {{-- <form>
<h5>Subscribe to our newsletter</h5> <h5>Subscribe to our newsletter</h5>
<p>Monthly digest of what's new and exciting from us.</p> <p>Monthly digest of what's new and exciting from us.</p>
<div class="d-flex flex-column flex-sm-row w-100 gap-2"> <div class="d-flex flex-column flex-sm-row w-100 gap-2">

View File

@@ -1,4 +1,4 @@
@if($enabled) @if ($enabled)
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ $id }}" <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ $id }}" height="0" width="0"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> style="display:none;visibility:hidden"></iframe></noscript>
@endif @endif

View File

@@ -1,16 +1,27 @@
@if($enabled) @if ($enabled)
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
@unless(empty($dataLayer->toArray())) @unless (empty($dataLayer->toArray()))
window.dataLayer.push({!! $dataLayer->toJson() !!}); window.dataLayer.push({!! $dataLayer->toJson() !!});
@endunless @endunless
@foreach($pushData as $item) @foreach ($pushData as $item)
window.dataLayer.push({!! $item->toJson() !!}); window.dataLayer.push({!! $item->toJson() !!});
@endforeach @endforeach
</script> </script>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': <script>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], (function(w, d, s, l, i) {
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= w[l] = w[l] || [];
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); w[l].push({
})(window,document,'script','dataLayer','{{ $id }}');</script> 'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '{{ $id }}');
</script>
@endif @endif

View File

@@ -12,9 +12,8 @@
| be assigned to the "web" middleware group. Make something great! | be assigned to the "web" middleware group. Make something great!
| |
*/ */
Route::get('test', function () {
return App\Models\Post::first()->body; Route::feeds();
});
Auth::routes(); Auth::routes();

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
eval 'APP_URL=https://productalert.co php artisan ziggy:generate'; eval 'APP_URL=https://productalert.co php artisan ziggy:generate';
eval 'blade-formatter --write resources/\*_/_.blade.php'; eval 'blade-formatter --write resources/**/*.blade.php';
eval './vendor/bin/pint'; eval './vendor/bin/pint';
eval 'npm run build'; eval 'npm run build';