From fd8a4f01d12ea0811cdea51bc6d160e3db64015c Mon Sep 17 00:00:00 2001 From: Mohamed Jinas Date: Fri, 4 Sep 2020 00:38:41 +0500 Subject: [PATCH] Update --- app/Http/Controllers/ArticlesController.php | 6 ++++-- public/js/app.js | 2 +- public/mix-manifest.json | 2 +- resources/js/components/RecentStories.vue | 4 ++-- resources/js/components/SourceView.vue | 4 ++-- resources/js/components/TodaysPick.vue | 6 +++--- resources/views/topics/show.blade.php | 4 ++-- routes/web.php | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/ArticlesController.php b/app/Http/Controllers/ArticlesController.php index 4ffb737..a6519be 100644 --- a/app/Http/Controllers/ArticlesController.php +++ b/app/Http/Controllers/ArticlesController.php @@ -12,10 +12,12 @@ class ArticlesController extends Controller * * @param mixed $article */ - public function show(Article $article) + public function show($source, $guid) { return view('articles.show', [ - 'article' => $article + 'article' => Article::whereHas('source', function($q) use ($source) { + $q->where('slug', $source); + })->where('guid', $guid)->get()->first() ]); } } diff --git a/public/js/app.js b/public/js/app.js index ce3d089..5cbf4ad 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{0:function(t,e,s){s("bUC5"),t.exports=s("pyCd")},"9Wh1":function(t,e,s){window._=s("LvDl"),window.axios=s("vDqi"),window.axios.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",window.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))}},D9Y6:function(t,e,s){"use strict";var a=s("LoUn");s.n(a).a},"Fw+z":function(t,e,s){(t.exports=s("I1BE")(!1)).push([t.i,"\r\n",""])},LoUn:function(t,e,s){var a=s("Fw+z");"string"==typeof a&&(a=[[t.i,a,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};s("aET+")(a,i);a.locals&&(t.exports=a.locals)},RnhZ:function(t,e,s){var a={"./af":"K/tc","./af.js":"K/tc","./ar":"jnO4","./ar-dz":"o1bE","./ar-dz.js":"o1bE","./ar-kw":"Qj4J","./ar-kw.js":"Qj4J","./ar-ly":"HP3h","./ar-ly.js":"HP3h","./ar-ma":"CoRJ","./ar-ma.js":"CoRJ","./ar-sa":"gjCT","./ar-sa.js":"gjCT","./ar-tn":"bYM6","./ar-tn.js":"bYM6","./ar.js":"jnO4","./az":"SFxW","./az.js":"SFxW","./be":"H8ED","./be.js":"H8ED","./bg":"hKrs","./bg.js":"hKrs","./bm":"p/rL","./bm.js":"p/rL","./bn":"kEOa","./bn.js":"kEOa","./bo":"0mo+","./bo.js":"0mo+","./br":"aIdf","./br.js":"aIdf","./bs":"JVSJ","./bs.js":"JVSJ","./ca":"1xZ4","./ca.js":"1xZ4","./cs":"PA2r","./cs.js":"PA2r","./cv":"A+xa","./cv.js":"A+xa","./cy":"l5ep","./cy.js":"l5ep","./da":"DxQv","./da.js":"DxQv","./de":"tGlX","./de-at":"s+uk","./de-at.js":"s+uk","./de-ch":"u3GI","./de-ch.js":"u3GI","./de.js":"tGlX","./dv":"WYrj","./dv.js":"WYrj","./el":"jUeY","./el.js":"jUeY","./en-au":"Dmvi","./en-au.js":"Dmvi","./en-ca":"OIYi","./en-ca.js":"OIYi","./en-gb":"Oaa7","./en-gb.js":"Oaa7","./en-ie":"4dOw","./en-ie.js":"4dOw","./en-il":"czMo","./en-il.js":"czMo","./en-in":"7C5Q","./en-in.js":"7C5Q","./en-nz":"b1Dy","./en-nz.js":"b1Dy","./en-sg":"t+mt","./en-sg.js":"t+mt","./eo":"Zduo","./eo.js":"Zduo","./es":"iYuL","./es-do":"CjzT","./es-do.js":"CjzT","./es-us":"Vclq","./es-us.js":"Vclq","./es.js":"iYuL","./et":"7BjC","./et.js":"7BjC","./eu":"D/JM","./eu.js":"D/JM","./fa":"jfSC","./fa.js":"jfSC","./fi":"gekB","./fi.js":"gekB","./fil":"1ppg","./fil.js":"1ppg","./fo":"ByF4","./fo.js":"ByF4","./fr":"nyYc","./fr-ca":"2fjn","./fr-ca.js":"2fjn","./fr-ch":"Dkky","./fr-ch.js":"Dkky","./fr.js":"nyYc","./fy":"cRix","./fy.js":"cRix","./ga":"USCx","./ga.js":"USCx","./gd":"9rRi","./gd.js":"9rRi","./gl":"iEDd","./gl.js":"iEDd","./gom-deva":"qvJo","./gom-deva.js":"qvJo","./gom-latn":"DKr+","./gom-latn.js":"DKr+","./gu":"4MV3","./gu.js":"4MV3","./he":"x6pH","./he.js":"x6pH","./hi":"3E1r","./hi.js":"3E1r","./hr":"S6ln","./hr.js":"S6ln","./hu":"WxRl","./hu.js":"WxRl","./hy-am":"1rYy","./hy-am.js":"1rYy","./id":"UDhR","./id.js":"UDhR","./is":"BVg3","./is.js":"BVg3","./it":"bpih","./it-ch":"bxKX","./it-ch.js":"bxKX","./it.js":"bpih","./ja":"B55N","./ja.js":"B55N","./jv":"tUCv","./jv.js":"tUCv","./ka":"IBtZ","./ka.js":"IBtZ","./kk":"bXm7","./kk.js":"bXm7","./km":"6B0Y","./km.js":"6B0Y","./kn":"PpIw","./kn.js":"PpIw","./ko":"Ivi+","./ko.js":"Ivi+","./ku":"JCF/","./ku.js":"JCF/","./ky":"lgnt","./ky.js":"lgnt","./lb":"RAwQ","./lb.js":"RAwQ","./lo":"sp3z","./lo.js":"sp3z","./lt":"JvlW","./lt.js":"JvlW","./lv":"uXwI","./lv.js":"uXwI","./me":"KTz0","./me.js":"KTz0","./mi":"aIsn","./mi.js":"aIsn","./mk":"aQkU","./mk.js":"aQkU","./ml":"AvvY","./ml.js":"AvvY","./mn":"lYtQ","./mn.js":"lYtQ","./mr":"Ob0Z","./mr.js":"Ob0Z","./ms":"6+QB","./ms-my":"ZAMP","./ms-my.js":"ZAMP","./ms.js":"6+QB","./mt":"G0Uy","./mt.js":"G0Uy","./my":"honF","./my.js":"honF","./nb":"bOMt","./nb.js":"bOMt","./ne":"OjkT","./ne.js":"OjkT","./nl":"+s0g","./nl-be":"2ykv","./nl-be.js":"2ykv","./nl.js":"+s0g","./nn":"uEye","./nn.js":"uEye","./oc-lnc":"Fnuy","./oc-lnc.js":"Fnuy","./pa-in":"8/+R","./pa-in.js":"8/+R","./pl":"jVdC","./pl.js":"jVdC","./pt":"8mBD","./pt-br":"0tRk","./pt-br.js":"0tRk","./pt.js":"8mBD","./ro":"lyxo","./ro.js":"lyxo","./ru":"lXzo","./ru.js":"lXzo","./sd":"Z4QM","./sd.js":"Z4QM","./se":"//9w","./se.js":"//9w","./si":"7aV9","./si.js":"7aV9","./sk":"e+ae","./sk.js":"e+ae","./sl":"gVVK","./sl.js":"gVVK","./sq":"yPMs","./sq.js":"yPMs","./sr":"zx6S","./sr-cyrl":"E+lV","./sr-cyrl.js":"E+lV","./sr.js":"zx6S","./ss":"Ur1D","./ss.js":"Ur1D","./sv":"X709","./sv.js":"X709","./sw":"dNwA","./sw.js":"dNwA","./ta":"PeUW","./ta.js":"PeUW","./te":"XLvN","./te.js":"XLvN","./tet":"V2x9","./tet.js":"V2x9","./tg":"Oxv6","./tg.js":"Oxv6","./th":"EOgW","./th.js":"EOgW","./tk":"Wv91","./tk.js":"Wv91","./tl-ph":"Dzi0","./tl-ph.js":"Dzi0","./tlh":"z3Vd","./tlh.js":"z3Vd","./tr":"DoHr","./tr.js":"DoHr","./tzl":"z1FC","./tzl.js":"z1FC","./tzm":"wQk9","./tzm-latn":"tT3J","./tzm-latn.js":"tT3J","./tzm.js":"wQk9","./ug-cn":"YRex","./ug-cn.js":"YRex","./uk":"raLr","./uk.js":"raLr","./ur":"UpQW","./ur.js":"UpQW","./uz":"Loxo","./uz-latn":"AQ68","./uz-latn.js":"AQ68","./uz.js":"Loxo","./vi":"KSF8","./vi.js":"KSF8","./x-pseudo":"/X5v","./x-pseudo.js":"/X5v","./yo":"fzPg","./yo.js":"fzPg","./zh-cn":"XDpg","./zh-cn.js":"XDpg","./zh-hk":"SatO","./zh-hk.js":"SatO","./zh-mo":"OmwH","./zh-mo.js":"OmwH","./zh-tw":"kOpN","./zh-tw.js":"kOpN"};function i(t){var e=r(t);return s(e)}function r(t){if(!s.o(a,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return a[t]}i.keys=function(){return Object.keys(a)},i.resolve=r,t.exports=i,i.id="RnhZ"},bUC5:function(t,e,s){"use strict";s.r(e);var a=s("XuX8"),i=s.n(a),r=s("wd/R"),n={name:"todays-pick",data:function(){return{article:[],subarticles:[],listarticles:[]}},filters:{dhivehiDate:function(t){return t?(r.locale("dv"),r(t).format("Do MMMM YYYY h:mm")):""}},mounted:function(){var t=this;axios.get("api/today").then((function(e){t.article=e.data[0],t.subarticles=e.data.slice(1,3),t.listarticles=e.data.slice(3,7)})).catch((function(t){console.log(t)}))}},l=s("KHd+"),o=Object(l.a)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"container mx-auto mb-5 border-b"},[t._m(0),t._v(" "),s("div",{staticClass:"flex md:-mx-4 flex-wrap md:px-0 flex-row-reverse"},[s("div",{staticClass:"w-full md:w-1/2 px-4 py-4"},[s("div",[s("img",{staticClass:"rounded",attrs:{src:t.article.featured_image}})]),t._v(" "),s("div",{staticClass:"flex flex-col justify-end"},[s("a",{staticClass:"text-2xl md:text-3xl lg:text-3xl leading-11 text-gray-700 pb-4 pt-4 MvTyper font-semibold hover:underline",staticStyle:{direction:"rtl"},attrs:{href:"/article/"+t.article.id},domProps:{textContent:t._s(t.article.title)}}),t._v(" "),t.article.body?s("p",{staticClass:"ml-1 mb-4 text-gray-600 text-right MvTyper",staticStyle:{direction:"rtl"}},[t._v("\n "+t._s(t.article.body[0].slice(0,200))+"...\n ")]):t._e()]),t._v(" "),s("div",{staticClass:"flex justify-end items-center mt-3"},[s("div",[t.article.source?s("a",{staticClass:"hover:underline",attrs:{href:"/source/"+t.article.source.slug}},[s("p",{staticClass:"font-semibold text-gray-700 text-sm capitalize MvTyper",domProps:{textContent:t._s(t.article.source.name)}})]):t._e()]),t._v(" "),t.article.source?s("img",{staticClass:"h-10 w-10 rounded-full ml-1 object-cover",attrs:{src:t.article.source.logo}}):t._e()]),t._v(" "),s("div",{staticClass:"text-gray-600 text-md mt-4 flex justify-end items-center mb-3"},[s("p",{staticClass:"ml-1 text-gray-600 text-right MvTyper",staticStyle:{direction:"rtl"}},[t._v("\n "+t._s(t._f("dhivehiDate")(t.article.published_date))+"\n ")])])]),t._v(" "),s("div",{staticClass:"w-full md:w-1/4"},[s("div",{staticClass:"flex md:-mx-4 flex-wrap mb-7 md:px-0 rtl"},t._l(t.subarticles,(function(e){return s("div",{key:e.id,staticClass:"w-1/2 md:w-full lg:w-full px-4 md:px-8 lg:px-8 py-4"},[s("div",{staticClass:"flex justify-end"},[s("img",{staticClass:"rounded",attrs:{src:e.featured_image}})]),t._v(" "),s("div",{staticClass:"flex justify-end"},[s("a",{staticClass:"text-md leading-9 font-semibold py-3 text-gray-700 MvTyper",staticStyle:{direction:"rtl"},attrs:{href:"/article/"+e.id},domProps:{textContent:t._s(e.title)}})]),t._v(" "),s("div",{staticClass:"flex flex-row-reverse justify-between mt-2"},[s("div",{staticClass:"flex justify-end items-center"},[s("div",[s("p",{staticClass:"font-semibold text-gray-600 text-sm capitalize MvTyper",domProps:{textContent:t._s(e.source.name)}})]),t._v(" "),s("img",{staticClass:"h-8 w-8 rounded-full ml-1 object-cover",attrs:{src:e.source.logo}})])])])})),0)]),t._v(" "),s("div",{staticClass:"w-full md:w-1/4 px-4 py-4"},[s("ul",{staticClass:"mt-8 sm:mt-8 md:mt-0 lg:mt-0",staticStyle:{"list-style":"none",float:"right",padding:"0px"}},t._l(t.listarticles,(function(e){return s("li",{key:e.id,staticClass:"pb-8"},[s("div",{staticClass:"flex justify-end"},[s("a",{staticClass:"text-md leading-normal text-gray-800 pb-4 MvTyper text-right hover:underline",staticStyle:{direction:"rtl"},attrs:{href:"/article/"+e.id},domProps:{textContent:t._s(e.title)}})]),t._v(" "),s("div",{staticClass:"border-b mb-3"}),t._v(" "),s("div",{staticClass:"flex justify-between items-center flex-row-reverse"},[s("div",{staticClass:"flex items-end flex-col"},[s("a",{staticClass:"hover:underline",attrs:{href:"/source/"+e.source.slug}},[s("span",{staticClass:"MvTyper text-sm text-gray-600",domProps:{textContent:t._s(e.source.name)}})])]),t._v(" "),s("div",[s("span",{staticClass:"MvTyper text-sm text-gray-600"},[t._v(t._s(t._f("dhivehiDate")(e.published_date)))])])])])})),0)])])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("h2",{staticClass:"text-gray-800 text-3xl text-right mt-3 mb-2 mr-2 MvAamu",staticStyle:{"font-weight":"100"}},[this._v("\n މިއަދުގެ ޚުލާޞާ\n ")])])}],!1,null,null,null).exports,c={name:"discover-topics",data:function(){return{topics:[]}},mounted:function(){var t=this;axios.get("api/topics").then((function(e){t.topics=e.data.data})).catch((function(t){console.log(t)}))}},d=Object(l.a)(c,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"border-b"},[t._m(0),t._v(" "),s("div",{staticClass:"flex flex-wrap justify-center"},t._l(t.topics,(function(e){return s("a",{key:e.id,staticClass:"text-sm font-medium border border-gray-700 py-1 px-3 rounded-full mr-2 mt-2 mb-4 hover:bg-green-100 MvTyper",staticStyle:{color:"#4A5568"},attrs:{href:"/topic/"+e.slug},domProps:{textContent:t._s(e.name)}})})),0)])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("h2",{staticClass:"text-gray-800 text-3xl text-center mt-3 mb-2 MvAamu",staticStyle:{"font-weight":"100"}},[this._v("\n ތަފާތު މައުޟޫޢުތައް\n ")])])}],!1,null,null,null).exports,u={name:"recent-stories",data:function(){return{recentStories:[]}},filters:{dhivehiDate:function(t){return t?(r.locale("dv"),r(t).format("Do MMMM YYYY h:mm")):""}},mounted:function(){var t=this;axios.get("api/recent").then((function(e){t.recentStories=e.data.articles.data})).catch((function(t){console.log(t)}))}},m=(s("D9Y6"),Object(l.a)(u,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"mb-10"},[t._m(0),t._v(" "),s("div",{staticClass:"container mx-auto"},[s("div",{staticClass:"flex md:-mx-4 flex-row-reverse flex-wrap mb-7 md:px-0"},t._l(t.recentStories,(function(e){return s("div",{key:e.id,staticClass:"w-1/2 md:w-1/4 px-4 py-4 flex-grow"},[s("a",{attrs:{href:"/article/"+e.id}},[s("div",{staticClass:"w-full h-auto overflow-hidden relative rounded"},[s("img",{attrs:{src:e.featured_image}})])]),t._v(" "),s("div",{staticClass:"w-full h-auto text-right overflow-hidden mt-3"},[s("a",{staticClass:"text-md leading-9 font-semibold text-right text-gray-700 py-3 MvTyper hover:underline",staticStyle:{direction:"rtl"},attrs:{href:"/article/"+e.id},domProps:{textContent:t._s(e.title)}}),t._v(" "),s("div",{staticClass:"flex items-center justify-end mt-3 mb-3"},[s("a",{attrs:{href:"/source/"+e.source.slug}},[s("div",{staticClass:"flex justify-end items-center"},[s("div",[s("p",{staticClass:"font-semibold text-gray-600 text-sm capitalize MvTyper",domProps:{textContent:t._s(e.source.name)}})]),t._v(" "),s("img",{staticClass:"h-10 w-10 rounded-full ml-1 object-cover",attrs:{src:e.source.logo}})])])]),t._v(" "),s("p",{staticClass:"ml-1 text-gray-600 text-right MvTyper",staticStyle:{direction:"rtl","font-size":"13px"}},[t._v("\n "+t._s(t._f("dhivehiDate")(e.published_date))+"\n ")])])])})),0)])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("h3",{staticClass:"text-gray-800 text-3xl text-center mt-5 mb-2 mr-3 MvAamu",staticStyle:{"font-weight":"100"}},[this._v("\n ފަހުގެ ޚަބަރުތަށް\n ")])])}],!1,null,null,null).exports),f={name:"available-sources",data:function(){return{sources:[]}},mounted:function(){var t=this;axios.get("/api/sources").then((function(e){t.sources=e.data.data}))}},v=Object(l.a)(f,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"border-b mt-5"},[e("div",{staticClass:"mb-5"},[this._m(0),this._v(" "),e("div",{staticClass:"flex flex-wrap justify-center"},this._l(this.sources,(function(t){return e("a",{key:t.id,staticClass:"flex flex-col items-center shadow hover:shadow-lg mr-5 rounded p-10 mt-3",attrs:{href:"/source/"+t.slug}},[e("img",{staticClass:"h-16 w-16",attrs:{src:t.logo,alt:t.name}})])})),0)])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",[e("h2",{staticClass:"text-gray-800 text-3xl text-center mt-3 mb-2 MvAamu",staticStyle:{"font-weight":"100"}},[this._v("\n މަސްދަރުތަށް\n ")])])}],!1,null,null,null).exports;function x(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return h(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return h(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,a=new Array(e);st.length)&&(e=t.length);for(var s=0,a=new Array(e);s - +
@@ -25,7 +25,7 @@
- + - +
diff --git a/resources/js/components/TodaysPick.vue b/resources/js/components/TodaysPick.vue index daf5517..85a4ba0 100644 --- a/resources/js/components/TodaysPick.vue +++ b/resources/js/components/TodaysPick.vue @@ -15,7 +15,7 @@
- + {{$article->meta['title']}} @@ -32,7 +32,7 @@
{{$article->source->name}}
- +
{{$article->title}}
diff --git a/routes/web.php b/routes/web.php index c23a781..df50b97 100644 --- a/routes/web.php +++ b/routes/web.php @@ -35,7 +35,7 @@ Route::get('/download/android', function () { ]); }); -Route::get('/article/{article:id}', [ArticlesController::class, 'show'])->name('articles.show'); +Route::get('/article/{source}/{guid}', [ArticlesController::class, 'show'])->name('articles.show'); Route::get('/topic/{topic:slug}', [TopicsController::class, 'show'])->name('topics.show'); Route::get('/source/{source:slug}', [SourcesController::class, 'show'])->name('sources.show');