Implement web push in laravel - laravel-8

I m trying to implement web push notification in my laravel application and I have setup web push for laravel by follow along the tutorial from the tutorial below
https://medium.com/#sagarmaheshwary31/push-notifications-with-laravel-and-webpush-446884265aaa
but there are still some question that I am not understand
Why we need the push_subscription in database ? It seems like I not even used it elsewhere ?
laravel notification not working ( if i did like this )
$users = User::whereIn('id', $vendor_user_ids)->get();
Notification::send($users, new WebChatPushNotification($chat));
but it work if I use Notification::send(User::all(), new WebChatPushNotification($chat));
since both of them are also a collection of user model, but why the latest one work.
and is there any other tutorial that can explain about web push more better that are recommended ?
Oh ya, for your information, I am using Laravel 8 and laravel-notification-channels/webpush package
Thanks in advance!

Finnally, I managed to solve it by myself.
the package itself will need to query the user's endpoint from the table when we try to notify the user.
Notification wont show because my $users is null, so nobody will be notify. such a silly mistakes, sorry for trying to ask such silly question here.

Related

Ionic 3 - Load translation from API URL

I'm actually working on a mobile app with Ionic 3, everything is ok till now. Eveything work fine. I set translation with ngx-translate. So i got all my files in a folder "/assets/i18n/". I can call my data in templates or components so everything is ok.
But my client, wants that those translation files come from a web API. SO they can update them as they want. I searched here on found some things like this link "Ngx-translate - TranslateHttpLoader with external URL" ( I didn't want to answer this topic cause I don't have answer, just questions and as my profile is new I can't comment it )
I read all of this but i can't understand it perfectly so, i keep missing something, so please how can i create a custom loader for calling those translation file ?
I tried to create a provider/service but is that a specific kind of file for a loader ? Where to put it in my app ?
That's the last stop for my app to run. So please if someone know the answer can you help me a little bit with it ? I want to understand exactly how to call those json film from URL !
I can add more code if you want, but actually i got no error i just don't know how to create this "loader" from last topic. And where to put it.

Kucoin Exchange Kline Get API Response is wrong

hey guys does somebody know why i dont get the correct response from thhis api call:
https://api.kucoin.com/v1/open/kline?symbol=LTC-BTC&type=1hour&from=1517446866&to=1518311025&limit=1000
it should give me normaly a couple of candelstick data back
i have code already for other exchanges with her api and did not have problems
but this one i dont know if i make somethink wrong or maybe the api from this exchange have a error
the documentation site is this: https://kucoinapidocs.docs.apiary.io/#reference/0/market/get-kline-data(open)
You are using an outdated API.
KuCoin switched to TradingView as its chart software. This is why you have https://www.kucoin.com/#/trade.pro/LTC-BTC as the default view for trading. You can still access the old view via https://www.kucoin.com/#/trade/LTC-BTC.
Looks like the API call you are using was made for the old version.
Use this URL instead:
https://api.kucoin.com/v1/open/chart/history
Working URL:
https://api.kucoin.com/v1/open/chart/history?symbol=LTC-BTC&type=1hour&from=1517446866&to=1518311025&limit=1000
For more information about the new API call: (notice how it says tradingview-version!)
https://kucoinapidocs.docs.apiary.io/#reference/0/market/get-kline-data(open,-tradingview-version)

Laravel 5.2 custom Middleware Levels on RESTful controllers

So from not using any framework at all, I finally forced myself to use LARAVEL 5.2 because i got tired of re-writing my own "framework" over and over again.
Anyway!
I think I'm pretty familiar with the Laravel framework and its dependencies now.
But now I need guidance on how to do this the smartest way.
I want to create a Middleware based on the companys DC.
Now every user is AUTHED by php's envget("username"); with a re-written "auth" middleware. So far, so good. (The server is not in the DMZ btw).
The thing is, our team thought that we should populate a database-table with all the users and give them a "Privilege-level", lets say 1 through 3 where 1 is "read only", 2 is "read+modify" and 3 is "read+create+modify" with our restful controllers. But.
since we use restful controllers i cannot really give them individual Middlewares? do I manually have to change every RESTful resource in my routes.php to make this happend? or can i do this another way? I would like to keep it as simple as possible.
Any suggestions?
Thanks in advance
(reserved for typsos )
#Tarre Tan
You can achieve this by adding your middleware in a parent controller's constructor.
All your controllers that require permissions will inherit from that controller.
You have one place to adjust your permissions if you want.
Hope this helps

Subscribe button is not showed up for an published API using WSO2 AM 1.9

I published one API using Publisher API.
While adding API I had added subcriptions like below :
default_version_checked=default_version, tiersCollection=Unlimited,Gold,Silver,Bronze, transport_http=http, transport_https=https, inSequence=none, outSequence=none, faultSequence=none, responseCache=Disabled, **subscriptions=all_tenants**, ...........
While publishing I had added below query param as well:
action=updateStatus, name=xxxxx, version=1.0, provider=admin, status=PUBLISHED, publishToGateway=true, **subscriptions=all_tenants**
The API is showing good in Publisher Ui as well as STORE UI, but there is no subscription button for that published API! I tested with old and new consumer as well.
I am surprised. Anything more I need to add for the subcription flow? More over I could not found any "Subcription" management option like (all tenant/current tenant/..) for WSO2 AM 1.9; it was there for AM 1.8.
Can anyone please help me to enable subcribe button in API store?
I got the answer by debugging my code.
It is not related to to any tag mentioned above.
It is actually related to one query param "advertiseOnly".
If I use advertiseOnly=true, it is not allowing to subscribe; it is like advertising.
When I use "advertiseOnly=false", subscribe button is showing. Problem solved.

how to create new controller and model in Refinerycms and how use it?

here, I want to create a application using refinery for that I need one new table resto. and to access that table I want to use my own controller resto.
how it is possible ? please help me....
As #sevenseacat mentioned, that refinery guide has a basic walkthrough of extending refinirycms. Also if you haven't looked there already, Railscasts has a 2-episode series on refinerycms. The second one deals with the subject you want but is a pro episode and you'd need to subscribe, but if you're doing any work with rails the pro subscription ($9/month) pays for itself very quickly.
Note: I am not affiliated with Railscasts in any way.