Member Since 1 Year Ago

Experience Points

400 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
Best Reply Awards
Best Reply
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
4,600 XP
1 week ago
Activity icon

Replied to Jquery Event For Child Element

Definitely helpful. Thanks.

1 week ago
Activity icon

Replied to Jquery Event For Child Element

Basically, I am trying to reduce my jquery dependency and trying to use VueJS. But I cannot find a proper replacement on how to have Modal box which be dynamic and it can have forms with tinymce editor and select2 kind of library. If anyone can help me with the substitute for them in Vue JS then would be great.

Activity icon

Replied to Jquery Event For Child Element

<a id="eThread_1704062ef78c2723" href="javascript:void(0);" class="media" style="border-bottom: 1px solid rgb(228, 231, 237) !important;">
    <div class="media-left pr-1">
        <span class="avatar avatar-md"><span class="media-object rounded-circle text-circle bg-grey">G</span></span>
    <div class="media-body w-100">
        <h6 class="list-group-item-heading">
            <span class="float-right"><span class="font-small-2 primary">Thu, Feb 13 21:09</span> <span id="setLinks_14_1704062ef78c2723"><i class="fa fa-external-link"></i></span></span>
        <p class="list-group-item-text text-truncate mb-0">Security alert</p> 
        <p class="list-group-item-text mb-0" style="margin-top: 10px;">API was granted access.</p>

Thanks for reverting. Above code works but it disables click event on all other child elements as well. I would just want that span with id "setLinks" should not trigger parent click function and secondly access it using jquery so that I can open a modal box on click.

Activity icon

Started a new Conversation Jquery Event For Child Element

<a v-for="thread in threads" :id="'eThread_'+thread.threadId" href="javascript:void(0);" @click="fetchEmails(thread.threadId)">
    <h6> Subject of email</h6>
    <span :id="'setLinks_14_'+thread.threadId"><i class="fa fa-external-link"></i></span>

I want to capture the click event for id "setLinks*" using jquery. But clicking on it fires vuejs click function. What I want to do is capturing event for child elements using jquery. Reason for doing so it, I am new to VueJS and don't want to waste time in implementing modal, tinymce field, select2 library etc using proper Vue approach. I would rather keep those working with jquery owing to time constraint.

1 month ago
Activity icon

Replied to Query Builder Not Working As Expected

$queryUnread = $queryRead = \App\UserActivity::select($select)->orderBy('users_activities.id', 'desc');

I assume above would be creating two separate instance. Seems like a lot is left to know how Laravel works :)

Thank you @tykus @bobbybouwmann

Activity icon

Started a new Conversation Query Builder Not Working As Expected

$queryUnread = $queryRead = \App\UserActivity::select($select)->orderBy('users_activities.id', 'desc');                     
//All Unread notifications        
$notificationsRead = $queryRead->whereNull('activities_notifiers.read_at')->get();
//All Read notifications
$notificationsUnread = $queryUnread->whereNotNull('activities_notifiers.read_at')->limit(5)->get();

The above doest work separately. $queryUnread executes below query

select * from activities_notifiers where read_at is null and read_at is not null order by id desc limit 5

The $queryUnread is having both whereNull and whereNotNull condition. What is the correct way of using builder especially when we have to build query based on different condition?

2 months ago
Activity icon

Started a new Conversation Relation Without Foreignkey

I am trying to create a entity based system where I can manage different entities developed. Entity table is id, name, attributes, searchable, permission, icon etc fields.

There are multiple entities like Customer, Project, Product, Events, Notes etc..... Each have separate table and thus a model and I have a constructor function as below:-

public function __construct($attributes = array()) {
        $this->entitytype= \App\Entity::find(1); 
// 1 is the record for Customer in entity table

I was just wondering if this can be achieved in any ways by relations. I know type but don't store it. May be any static way I can do it with relations so that I can load entitytype only when needed rather than on all instance.

2 months ago
Activity icon

Replied to ErrorException Not Displaying

I was not aware of it. I am not sure why it is happening. I guess I am getting this error page may be after updating the project to Laravel 6.0.

I might have messed up somewhere so need help in fixing it. Checked the error handling page as well and it also is same as default laravel 6.0.

Activity icon

Started a new Conversation ErrorException Not Displaying

Laravel error page displayed before or in other project - https://imgur.com/a/nC3qq05

But don't know now for any kind of error, its showing below error page. In other project it is showing error as above but just in one project its' showing error like below. Does it have anything to do with laravel version?


ENV Variables are as below:


Also, used different commands like below

php artisan optimize
php artisan route:cache
php artisan cache:clear
php artisan config:cache
composer dump-autoload -o
2 months ago
Activity icon

Replied to Third Party Api Structure

Great... Thanks.

I was wondering if you can help with a reference url or something that guides in implementing third party api's in a much better or efficient manner.

Activity icon

Replied to Third Party Api Structure

Thank you for taking out time to revert with the code. Haven't thought of this way. After checking out many references I opted to used singleton approach with a service container as below:

In AppServiceProvider's boot method

$this->app->singleton(ThirdPartyApi::class, function() {
    return new ThirdPartyApi(new \GuzzleHttp\Client([
        'base_uri' => config('services.baseurl'),
        'headers' => [
            'Content-Type' => 'application/json',
            'customer_name' => config('services.customername'),
            'customer_key' => config('services.customerkey')

Class ThirdPartyApi which will have functions to consume an api

namespace App\Services;
use GuzzleHttp\Client;      
class ThirdPartyApi {

    public $client;

    public function __construct(Client $client) {
        $this->client = $client;

    public function authentication() {
        $url = 'get_authn_url';
        $data = [];
        try {
            $response = $this->client->post($url);
            $statuscode = $response->getStatusCode();
            if ($statuscode == 200) {
                $responseData = json_decode($response->getBody()->getContents());                
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            $response = $e->getResponse();
            $responseBodyAsString = $response->getBody()->getContents();            
        } catch (\GuzzleHttp\Exception\ConnectException $e) {
            $response = $e->getResponse();            

Finally, using it in a controller function as below

$apiClient = app(\App\Services\ThirdPartyApi::class);

I am not sure now which seems to be a correct way to go ahead.

Activity icon

Started a new Conversation Third Party Api Structure

I am looking to consume a third party api. I would use Guzzle to call third party urls and fetch the result. Now in each controller function I will have to use a sample code as below to make calls

$client = new \GuzzleHttp\Client([
            'base_uri' => 'http://xxx.xxx.xxx:3000',
            'headers' => [
                'Content-Type' => 'application/json',
                'customer_name' => 'test',
                'customer_key' => 's324ghe7cf77f652ef2f030b9f26'
$url = 'actions/authenticate';

I tried to google and find a solution and understand but failed how can I create a wrapper for such commands so that I can easily just make a call in the controller function to fetch the data. I come across using singleton, service container but could not figure out how exactly to structure the code and execute it.

Would be great If someone can guide me how to achieve that?

3 months ago
Activity icon

Replied to Messaging Like Facebook

@bobbybouwmann Yes as of now that's what I am doing. I have one listener where I listen to messages sent from other users and another channel with sender and receiver information and just listen to whispers. Thanks for your time.

Activity icon

Replied to Laravel Notifications Or Custom One?

@punksolid I guess my requirement is bit different. I have users subscribing to an object. So whenever there is a change/activity on an object, I want to notify users about the change. So I have to use something like

 \Notification::send($users, new \App\Notifications\WebAndDatabaseNotification());

let x = no. of subscribers

Now if I want to store object information like object id, object type then I have to store it in "data" field of notifications table. So now there will be x records with same information in data column. Each user then will query notifications table and display those respective activity notifications.

3 months ago
Activity icon

Started a new Conversation Laravel Notifications Or Custom One?

Way1 - Using default notifications of laravel assumes a single notification entry for each user in "notifications" table and data field will also have duplicate data for same notification to multiple users. Isn't it create too much of duplicate data ?

Way2 - Can we not create an "activity_type" - id, type, message "activities table - id, creator_id, entity_type, entity_id, activity_type_id, created_on activity_notification - activity_id, notify_user_id

Which is the better way to implement notifications ?

Another thing is will it be a good idea to stores notfiable users in json field? I will not be having a large set of users. may be 50-200 max.

Activity icon

Replied to Messaging Like Facebook

Lets say two users. User1 and User2 and they both login and listen to their own channel i.e. Channel-User-1 & Channel-User-2

Now User1 send message to User2 so the send message event will broadcast on Channel-User-2. User2 is listening so he will get message. All good until I decided to implement whisper.

User1 is listening to Channel-User-1 so when he will type it cannot be conveyed/whispered to User2 who is listening on Channel-User-2. So I then whisper on a new public channel and that will be listened to. If any messages is intended for me then I will flash user typing. I am not sure what other better way but there should be one. Hope some can shed some light.

4 months ago
Activity icon

Started a new Conversation Messaging Like Facebook

I am trying to develop something which is a basic version of Facebook Messaging. I.e. a page where you have users on left and their messages on right.

I was wondering should I create different channel for each conversation with different users? Lets say I have 3 friends User2, User3, User4, User5 so should I create and listen to 4 private channels as below which will listen only on Chat page.

"PrivateChannel_User1_User2", "PrivateChannel_User1_User3", "PrivateChannel_User1_User4", "PrivateChannel_User1_User5"


Should I just create and listen to a global single "PrivateChannel_User1" which will listen to all kinds of events be it message or any other notification?

Currently, I have implemented the first way but it is giving me problems like on Chat page I register listener which are my friends but any new friend or messages from him will not be known. I will have to refresh page again.

Basically interested in knowing the proper approach on going ahead which such kind of application.

4 months ago
Activity icon

Replied to Register In Multiple Channels Laravel Echo

How did you went ahead with it? I am also wondering the same as I am trying to implement facebook messaging. So do i need to listen to no. of channel equal to no. of my friends.

In the sample that I implemented, I create a private channel between two users by taking the sender and receiver id as identifier.

Activity icon

Replied to Peer To Peer Chat - Channel Name

I am talking about creating a unique channel for two users. For ex. User 1 and User 2 are there and User 1 sends message to User2 then it will create channel as chat-message-1-2 and User 2 sends message to User 1 then it will create channel as chat-message-2-1

so User 1 will not get message from User2 and viceversa. How to avoid this situation? Not sure how your suggestion will help.


Activity icon

Started a new Conversation Peer To Peer Chat - Channel Name

I am currently working on to learn real time chat and I created a private channel named "chat-message" but it can be listened by all authenticated users.

So I have to name the channel as unique which only two users knows. Naming something as chat-message-sender_id-receiver_id will not work as it will create two different channels.

How can I create and identify a unique channel between two users?

4 months ago
Activity icon

Replied to Laravel Broadcasting - Preferable Way To Go

Thank you for updating me on this but I guess being a newbie both with VueJS, Laravel it was too much for me to learn and setup the socket.io/websockets, redis etc.

With time, I will definitely not want to use Pusher but as of now going ahead with Pusher so that I can concentrate on basic concepts and VueJS as well. Once i learn to implement I will go ahead and try and remove Pusher dependeny from code.

4 months ago
Activity icon

Replied to Understanding Package.Json

@audunru - Thank you for clarifying.... I kinda get it now which is Laravel way and which is not. I think I will follow using webpack.

@sinnbeck - Didn't knew about Envoy. Seems promising. Thanks for drawing attention towards it.

4 months ago
Activity icon

Replied to Understanding Package.Json

Thanks for reverting. Using webpack to create bundle will even result in not installing any of the NPM packages on the server. That I understand.

But just in case, Should I choose not to use webpack then I will have to use package-lock.json to install required packages on server. But to create that file on my development server, I will first have to move all required dependencies under "dependencies" then do "npm update" which will update package-lock.json and then I can use this file on production server. I think this is the way these work but just wanted to be sure of.

4 months ago
Activity icon

Started a new Conversation Understanding Package.Json

Below is dependencies in package.json file on my development server for a project. So basically these generates a package-lock.json which I have to commit on production server and which will install same dependencies on it.

Will the dependencies mentioned in "devDependencies" be included on production server? I guess no. If so then it means before I move project to production server I have to move/copy dependencies from "devDependencies" to "dependencies" and update the package-lock.json.

Please correct If my understanding is not correct and If there is any reference article which tells the correct procedure or steps for using the node packages from development to production.

 "devDependencies": {
        "axios": "^0.18.1",
        "cross-env": "^5.1",
        "laravel-mix": "^4.0.15",
        "lodash": "^4.17.15",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.15.2",
        "sass-loader": "^7.1.0",
        "vue-template-compiler": "^2.6.10"
 "dependencies": {
        "laravel-echo": "^1.6.1",
        "pusher-js": "^5.0.2",
        "vue": "^2.6.10"
4 months ago
Activity icon

Replied to Laravel Broadcasting - Preferable Way To Go

Seems a great one. Will go through it and start implementing to learn.

Pusher is a paid one so wondering which of the other two options will be great to implement performance wise?

Activity icon

Replied to Service Provider Not Updating After Redirecting

Gotcha.... Thanks for explaining.

4 months ago
Activity icon

Replied to Service Provider Not Updating After Redirecting

There is a "Read All Notification" button on the notification panel, clicking on which it redirects to a GET call i.e. index function of Notification controller and where I was marking notifications as read and fetching them again.

So I will have to redirect to a different route which marks as read all the notification and then redirect to the index function which fetches the notifications.


Activity icon

Started a new Conversation Laravel Broadcasting - Preferable Way To Go

I would like to implement some realtime functionalities like notifications or chat. The more I search the more it's confusing me.

You can use pusher, redis, nodes.js. laravel-websockets, ratchet. I guess there different ways to do this

  1. Laravel & Pusher and this way you don't have to implement the websockets server
  2. Laravel + Redis + socket.io
  3. Laravel websockets(Based on Ratchet)

I am thinking to start implementing with Laravel and Pusher and then once done think about implementing own server with nodejs or laravel websockets package.

Just wondering If my understanding is right and it's the right way to go for. I am totally a newbie and would like suggestion on selecting a proper approach to learn and implement this.

Activity icon

Started a new Conversation Service Provider Not Updating After Redirecting

I have created a NotificationServiceProvider and using ViewComposer displays the count and list of unread notifications by injecting viewcomposer in navigation layout. Let's say the total unread is 11.


Now I have created a NotificationController where in I have written below statements which marks all notifications as read and then fetch them and display in the view.

 $notifications = auth()->user()->notifications;
 return view('notifications.index', compact('notifications'));

When I click "Read All Notifications" on notifications panel, it redirects to notification listing page and displays all the notifications. However, the count still shows 11. I guess this is because the ServiceProvider code is executed first and then the code in controller.

One solutions is I mark notifications with an ajax call and then redirect to the notifications listing page.

Is this the correct way or there exist a better solutions?

Activity icon

Started a new Conversation ServiceProvider Named As One Of The Default Provider

I have created an application service provider named as PipelineServiceProvider and was not thrown any error on registered it as "App\Providers\PipelineServiceProvider::class"

Recently I found out that there already exists a framework service provider as "Illuminate\Pipeline\PipelineServiceProvider::class"

Just wondering if two service provider with same name will cause any problem?

4 months ago
Activity icon

Replied to Different Validation Rules For Different Methods?

Just an example of how I use in a Form Request

public function rules() {
    switch ($this->method()) {
            case 'POST': {
                    $rules = [ //Define your rules ];
            case 'PATCH': {
                    $rules = [//Define your rules ];
Activity icon

Replied to Super Function For Json Response

Do you mean something like this. Not sure If you are referring to something like this.


You can access the json object as an array.

4 months ago
Activity icon

Started a new Conversation Including/Excluding A Functionality Based On Permissions

I have different entities in my system. Like Customer, Project, Product, Events etc

Now, there is pipeline entity and the instance name is "Sample Pipeline" and with different stages "High", "Medium", "Low".

Now, different entity instances will be assigned to stages of "Sample Pipeline". So whenever I create/edit instance of each entity, I will have a dropdown to select the pipeline and the ajax will display another dropdown with stages. Upon saving the instance, I will attach the instance with a stage of pipeline.

I was wondering how or what functionality of laravel will be helpful so that I don't have to go and add the code in each controller, view of all entities. The code once created can be easily injected. Is this achieved with dependency injection or facades or something else as simple as widget or what?

Just need help with knowing how a functionality can be created once and can be injected or removed anytime. A reference links to understand a suggested functionality will be great.