Laravel Developer at Mumbai

Member Since 1 Year Ago


Experience Points

3,590 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 your 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-in-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 Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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
1,410 XP
1 week ago
Activity icon

Started a new Conversation Importance Of Composer.lock In Git / Version Control System

Since Composer is a dependency manager in PHP and its frameworks like Laravel, we know every dependency is managed in the composer.json file of the project, but do you know there is one more important file which handles the dependency more finely.

It is a composer.lock file.

What is composer.lock ?

The file composer.lock maintains dependency in more depth i.e it points to the actual commit of the version of the package we include in our software.

Let’s take an example and understand.


            "laravel/framework": "5.8.*",

Here, Suppose a lead developer is telling the composer to install laravel 5.8 with whatever latest minor version, for example 37 that is, the composer will install laravel 5.8.37 locally on the lead developer’s machine. At the same time a composer.lock file will be generated sometime like this:


            "name": "laravel/framework",
            "version": "v5.8.37",
            "source": {
                "type": "git",
                "url": "https://github.com/laravel/framework.git",
                "reference": "ce08aaee3a0b8bb58b459b2decf7f25ba7b10fa4"
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/laravel/framework/zipball/ce08aaee3a0b8bb58b459b2decf7f25ba7b10fa4",
                "reference": "ce08aaee3a0b8bb58b459b2decf7f25ba7b10fa4",
                "shasum": ""


Second part would be more interesting when this lead developer commits only composer.json but not composer.lock. Now when a junior developer clones the repository, it will contain obviously composer.json only and meanwhile there is another stable minor version comes suppose v5.8.40 in laravel main repository, so as soon as junior developer runs composer install / composer update command, the composer will read composer.json file and install Laravel v5.8.40 and generates the composer.lock locally.

In core essence, there might be many differences in code between laravel v5.8.37 and v5.8.40 though no breaking changes but it obviously defies the concept of version control system because Lead developer working on laravel v5.8.37 while junior developer working on laravel v5.8.40.

So if none of them commits and pushes the composer.lock there may be catastrophic conflicts on both side in future.

Why should we commit composer.lock as well ?

That’s because a locally installed composer will give first preference to composer.lock file over composer.json.

If lock file is not available in vcs the composer will point to composer.json file to install latest dependencies or versions.

The lock file actually points to the commit reference to download code so that originating code and target code remains the same if working in teams. Here you can see composer.lock refers to the actual commit id ce08aaee3a0b8bb58b459b2decf7f25ba7b10fa4 to download laravel v.5.8.*.

So when lead developer commits this file to the version control system, junior developers would also automatically be using the same code base as the lead developer.

That’s the power of composer.lock, to prevent conflicts among the teams.

Pro tip

If your are at the receiving end, i.e at junior level developer in a team, always use composer install instead composer update because composer install will only install dependencies as per the originating end i.e Lead developer and no modifications will be done in composer.lock file.

Just ask your lead developer if you are having issue in composer install command and tempted to use composer update command just because some random answer on stackoverflow suggests to do so.

Original article here

2 months ago
Activity icon

Started a new Conversation How To Switch Back To System Environment After Creating Tenant Using Laravel HYN Multi-tenant Package?

I am developing a multi-tenant laravel application using HYN Package.

Everything is working fine so far but whenever I create a tenant through system, I have to switch to that tenant's environment to seed a super admin user into that specific database.

See below how I am creating a tenant from system end.


public function createSchool(Request $request)

        $validator = Validator::make($request->all(),[
            'school_name' => 'required',
            'school_address' => 'required',
            'school_logo' => 'required|file',
            'school_type' => 'required',
            'school_sub_domain' => 'required',
            'school_email' => 'required',
            'school_default_password' => 'required',
            'school_modules' => 'required|array'

        if ($validator->fails()) {
            return redirect()->back()->withErrors($validator)->withInput();

        $website = new Website;
        $website->school_name = $request->school_name;
        $website->school_address = $request->school_address;
        //$website->school_logo = $request->school_logo;
        $website->school_type = $request->school_type;
        $website->school_email = $request->school_email;
        $website->school_default_password = $request->school_default_password;

        $school_logo = $request->file('school_logo');
        $allowed_file_extentions = [

        if (false == in_array($school_logo->getClientOriginalExtension(), $allowed_file_extentions)) {
            return back()->withErrors(['school_logo'=>'Allowed file types are jpeg,png,jpg,gif and svg']);

        $website->school_logo = 'NOT_SET';


        $logo_path = $website->uuid.'/logo/' . time() . '.' . $school_logo->getClientOriginalExtension();

        $t = Storage::disk('tenant')->put($logo_path, file_get_contents($school_logo), 'public');

        $website->school_logo = $logo_path;

        //creating hostname
        $hostname = new Hostname;
        $hostname->fqdn = $request->school_sub_domain.'.'.config('app.app_fqdn');

        app(HostnameRepository::class)->attach($hostname, $website);

        $school_modules = $request->school_modules;
        $school_modules_to_create = [];

        foreach($school_modules as $key => $value){
                'website_id' => $website->id,
                'module_id' => $value

        WebsiteModule::insert($school_modules_to_create); // System model

        //Switching to tenant environment to seed super admin for the tenant

        $tenancy = app(Environment::class);
        $tenancy->tenant(); // resolves $website

        $id = Staff::createSuperAdminFromSystem([
            'email' => $request->school_email,
            'password' => $request->school_default_password,

        return redirect()->route('system.add_module'); //Here I am getting issue.


Route::prefix('system')->group(function () {
    Route::get('login', ['as' => 'system.login', 'uses' => 'System\[email protected]']);
    Route::post('login-validate', ['as' => 'system.login.validate', 'uses' => 'System\[email protected]']);

    Route::group(['middleware' => ['system.auth']], function () {
        Route::get('dashboard', ['as' => 'system.dashboard', 'uses' => 'System\[email protected]']);

        Route::get('logout', ['as' => 'system.logout', 'uses' => 'System\[email protected]']);

        ########### Sidebar routes ###############
        Route::get('modules', ['as' => 'system.modules', 'uses' => 'System\[email protected]']);

        Route::get('add-module', ['as' => 'system.add_module', 'uses' => 'System\[email protected]']);
        Route::post('create-module', ['as' => 'system.create_module', 'uses' => 'System\[email protected]']);

        Route::get('add-school',['as' => 'add.school', 'uses' => 'System\[email protected]']);
        Route::post('create-school',['as' => 'system.create.school', 'uses' => 'System\[email protected]']);

As you can see route('system.add_module') is system route and lets suppose my system base url is http://example.com and accordingly I should get redirected to http://example.com/system/add-module but I get directed to http://<tenant_hostname>.example.com/system/add-module

Please help me in this regards as documentation quite ambiguous and difficult to understand.

2 months ago
Activity icon

Replied to Laravel 5.4 Send Mail With Attachment Giving Error - Using Mailtrap.io

I hope you have found the solution but for future users this blog might help you.

Sending mail with attachment using laravel 6 and mailtrap.io

2 months ago
Activity icon

Started a new Conversation Issues In Image Uploading Using Vue-wysiwyg

I am using vue-wysiwyg editor in my laravel-vue application. In this editor there is an option to upload images and through incomplete documentation of this package I am able to upload the image and get public url of the uploaded file. But this package works sometimes and does not work at all sometimes.

Here is how I am using this package


import wysiwyg from "vue-wysiwyg";

Vue.use(wysiwyg, {
    forcePlainTextOnPaste: true,
    image: {
        uploadURL: "/api/save-support-files",
        dropzoneOptions: {}


public function uploadUserFile(Request $request)
        $uploadedFile = $request->file('file');

        if (false == $uploadedFile) {
            return response()->api(false, 'Kindly upload a file');

        $allowed_file_extentions = [

        if (false == in_array($uploadedFile->getClientOriginalExtension(), $allowed_file_extentions)) {
            return response()->api(false,'Allowed file types are jpeg, png, jpg, gif, svg',null);

        $file_url = Storage::disk('public')->putFileAs('/support-files',$uploadedFile,generateRandomString('5').'.'.$uploadedFile->getClientOriginalExtension());

//        return response()->api(true,'File uploaded successfully',config('app.url').'/storage/'.$file_url);

        return config('app.url').'/storage/'.$file_url;

Issues I am facing right now:

  1. As soon as I select image from file browser, image is uploaded through api successfully but it is not showing in editor.

  2. Unable to select already uploaded image, I have to refresh the page and then again select file to upload it again.

Is anyone having solution to this problem ? Kindly help me out.

4 months ago
Activity icon

Started a new Conversation Unable To Track Window.open() And Window.close() Events In Some Mobile Chrome Browsers

I am trying to open a webpage/url in a new tab using window.open() and listening window.close() of child tab which was opened by parent tab.

This functionality is working fine in desktops but in mobile browsers like chrome mobile, window.open() opens the child tab but as soon as it is opened, connection between parent and child tab breaks.

I am sharing small snippet of my code below, please help me understand the issue. I am using Laravel 5.8 version here.

$('.btn-favorite').on('click', function () {
childWindow = window.open(url);

                    setInterval(function () {
                        if (childWindow != undefined) {
                            duration = duration - 1;
                            if (duration <= 0) {
                                //close the child window so that listenWindowCloseEvent will fire up
                            $('#job_status_' + job_id).html('<p class="spinner-counter">' + duration + '</p>').addClass('under-process');
                            listenWindowCloseEvent(job_id, duration);
                    }, 1000);


function listenWindowCloseEvent(job_id, duration) {
                if (childWindow.closed) {
                    if (duration > 0) {
                        $('#job_status_' + job_id).html('<span class="badge badge-pill badge-danger">Not Completed</span>').removeClass('under-process');
                    } else {
                        childWindow = undefined;

                        var url = '{{ route("make.site.visit.complete", array(":JOB_ID")) }}';
                        url = url.replace(':JOB_ID', job_id);

                        $.get(url, function (data, status) {
                            $('#job_status_' + job_id).html('<span class="badge badge-pill badge-success">Complete</span>').removeClass('under-process');

4 months ago
Activity icon

Replied to Working With JSON And Laravel Eloquent

Thank you @sinnbeck for your kind review, I shall update my article with your points. Haven't thought about it.

Activity icon

Started a new Conversation Working With JSON And Laravel Eloquent

Hello, I have written an article on how to access JSON fields in laravel eloquent query buider.

You can read it here and you can also download the pdf ebook of this article from the various Ebook/PDF providers which are listed at the end of the article.

I hope it will help many.

5 months ago
Activity icon

Started a new Conversation Laravel Storage Permission Issue On Nginx While Interacting With Other Domain Apis

This is a theoretical question, so please try to understand my problem.

Let me give you a overall scenario I am facing.

I have 2 different panels with 2 different domains both are developed in Laravel framework.

Panel 1: vendor panel (example: vendor_panel.com) Panel 2: user panel (example: user_panel.com)

Both are hosted under same system user in ubuntu nginx.

Both of these panel communicate with other using apis. that is, vendor panel fetches data from user panel and vice versa. In short both are same applications but with different domain names. I do hope you got my idea.

Now the problem: whenever any panel interacts with other panel, other panel's storage permission get affected, that is when vendor panel fetches data from user panel.

On the user panel I log the event using Log::info('vendor fetched data successfully') and vice versa.

Due to this I frequently get 500 error which is not logged by laravel due permission issues.

Please tell me how can I prevent this.

5 months ago
Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

Strange.. Now images are loaded, but on the homepage I have linked pdf files using those image now they are returning me 404 error.

<a href="https://www.workatyourplace.com/storage/files/workatyourplace-es.pdf" target="_blank" style="">
    <img src="https://www.workatyourplace.com/storage/images/flags/es.png" style="width: 22px; margin-right:5px; margin-left:10px " data-toggle="tooltip" data-placement="bottom" title="Spanish">
Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

please see the below screenshots, I hope you will get more idea.

Live Server : https://pasteboard.co/ICwmOuq.png

Localhost Server: https://pasteboard.co/ICwnaGqM.png

Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

Yes, I do have files in flags folder. One more thing, when I serve in localhost, I doesn't give any error.

Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

This is the actual url where I am getting error : https://www.workatyourplace.com/home/recent-user-registrations

Even my adblocker is turned off.

Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

Yes exactly. It does make an url but when accessed this results into 404 error.

Activity icon

Replied to Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

I do not have set ASSET_URL in .env file.

The problem is when I access css files using <link rel="stylesheet" href="{{asset('storage/css/app.css')}}"/> , is getting loaded in the page and url it generates is https://www.example.com/storage/css/app.css

Only problem I am getting is in images.

Activity icon

Started a new Conversation Symlinked Storage Folder And Its Files Are Inaccessible On Live Server

I have created symlink of storage/app/public to public folder successfully, now my public folder has a link to storage like public/storage.

All well and good so far, now I have added some image files in storage folder like this storage/app/public/images/flags/in.png.

But when I access the image in browser I am getting 404 Not Found Error and image is not loading. I am using asset() for example:

<img src="{{ asset('storage/images/flags/in.png') }}">

While images under storage/app/public/images/hello.png are loading successfully. Is the folder flags culprit here ?

Do I have to move my flag images back to images folder ?

Please guide me where I am going wrong.

5 months ago
5 months ago
Activity icon

Started a new Conversation Free Ebook On Laravel Artisan Commands

Hi all, I have made a PDF ebook on important artisan commands you can download it from slideshare.

Do comment your views.