admin laravel Notification system - laravel

Hi guys am working on an back-end system(admin) in laravel. I would like to send notifications realtime to the admin whenever a user makes some changes from thier side. for instance if a user creates a new project, i would like for the admin to be notified when the user submits the project details to the database. Please help me with a model of the same. thanks

Your question is very broad and you don't specify a clear problem. However, for real time notifications I'd suggest you to look at the following libraries: Socket IO, Ratchet and Pusher.

Related

How to change laravel notification user model receiver?

We have an API which connects to our own first party applications. Our API is sending out notifications based on user actions or if there is an update to the application etc.
Our API is modular structured.
Example
Our user model in API is located in App\Modules\Accounts\Models\User. Each month we send an invoice database notification to user from our API. In database it adds the notification and the notifiable_type is App\Modules\Accounts\Models\User.
But in our user application the user model is located in App\Modules\User which results user having 0 notifications.
Question
I know I can move the user model to exactly the same path in the user application but it seems somewhat wrong. Is there a way to tell the user model in our user application where to receive database notification on? Something like:
public function(){
return $this->receivesNotificationsFrom('App\Modules\Accounts\Models\User');
}
I would solve this in api as like this (suggesting, i would also use your namespace for users like you did, what i would never do, but lets suggest it). There are several ways to test, what is the best solution for you.
I would:
In your consuming app, you create a new model App\Modules\Accounts\Models\User that just extends your existing User class. I would test, if i can get to goal with this approach.
You create an artisan command to just rename the classes in your notification table and let this run by laravel's scheduler, so in your notifications table are the correct namespaces for your app.
This all "feels" wrong and i would never break with the defaults of App\User, because you run into traps like this and end up with "messy" solutions like 1 or 2.
Sry, i have no better ideas now, but maybe, it gives you some little inspirations 😉

Is there any way in laravel 5.4 to track how many time spent by login user?

Hi All Master Laravel,
I need your help to get data timespent from login user in laravel, I'm using Sentinel for login and Laravel 5.4
If only one page, we can use TimeOut javascript, but what I need is log for user which spent all page in my website
Regards,
Sidik
As I know there is no built-in solution for your purpose.
But you can write your personal implementation based on data from user requests.
Also, you can use third party service for this purpose too, for example Google Analytics. Here is an example how to set up the user ID into your analytics code.

Single User authentication in Laravel 5

I'm trying to build an internal admin system to get to grips with creating a Laravel app from scratch. Currently everything is public so I'm looking at implementing a very simple login system.
There will be no DB connection needed as we want a single user. We'll store the relevant username and password in the .env file most likely.
I feel like I've looked everywhere and haven't been able to find any tutorials covering this requirement! From everything I've read it seems I have to use a 'custom authentication driver' or possibly build my own user provider class but I have no idea how to go about this task.
The idea is that if the app is expanded in future we'd like to be able to just go back to using Laravel's built in db auth functionality. For this reason it would be nice to retain all the common methods relating to checking the current user, using auth middleware on my routes and managing login tokens etc.
Thanks in advance for any help offered.

Laravel session data over websocket

Recently I have being playing with a project I found on github called Laravel Websocket Poker (https://github.com/troymccormick/laravel-pkr/). I have it all running and working well. When you open the game page, you a presented with a dialog for your chosen username. I want to modify this, so that the session data of the current user is able to be used within the websockets.
So my question is, how can I associate the users laravel session info with their websocket connection?
Thank you!

Padrino basic user authentication

I was wondering if anyone can shed some light on setting up basic user authentication. I've installed the admin app into my project and it works great. But I need a basic user role that can have it's own registration page etc.
I need to see something like
domain.com/users/user.slug
would take them to their profile page
I'm also going to have nested resources, so a user can have a project associated to them.
domain.com/users/user.slug/projects/project.slug
or
domain.com/users/user.slug/project.slug
The admin piece worked great, but I have no idea how to setup registration etc for a user model?
I've used devise in the past with Rails and I'm wondering if anything like it currently exists? I've seen some discussion around warden. Is there a defacto solution that people are using or am I able to implement the admin app to handle this? Right now /accounts is protected and can only be accessed by the admin role.. so I can't have users go to accounts/new
Thanks
For now I basically just copied the admin app.. into my own Users app while using my own User model.
The user model is basically a direct port of the account model.. as is the session controller etc. Just switched the model names around.
I'm still not sure if this is the best approach or if I'm able to leverage the admin app to handle this also?
This solution is working, though again, I'm not sure if it's the optimal approach.

Resources