Vardhan_KSPL

Vardhan_KSPL

Member Since 3 Months Ago

Experience Points
900
Total
Experience

4,100 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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
900 XP
Feb
10
2 weeks ago
Feb
09
2 weeks ago
Activity icon

Replied to Loop Over An Array Sent With Ajax To Controller

As you said if the output is "14,21,12", json_decode("14,21,12") won't work because it is not a valid Json.

If you want to decode a Json array string, the passed input should be "[14,21,12]". This should decode to an array and you can iterate over it.

In your case, try this in your data key,

data: { "type":strUser , "_token": "{{ csrf_token() }}","ids":"["+JSON.stringify(selectedIds)}+"]",

Also, you can refer json validator sites like https://jsonlint.com/ to check for any input is a valid json so that it can be decoded using json_decode method.

Feb
08
2 weeks ago
Activity icon

Replied to Why Is Doctrine/dbal Package Not Present By Default?

It is not in my composer.json. I have to add it manually. I have observed this since Laravel 5 (which I started on).

Activity icon

Started a new Conversation Why Is Doctrine/dbal Package Not Present By Default?

I am curious as to why doctrine/dbal is not installed by default in Laravel application.

Jan
14
1 month ago
Activity icon

Awarded Best Reply on Passport Tokens - Delete Not Working

Solved it. The route was not passing through middleware 'auth:api'.

Activity icon

Replied to Passport Tokens - Delete Not Working

Solved it. The route was not passing through middleware 'auth:api'.

Activity icon

Started a new Conversation Passport Tokens - Delete Not Working

Auth::user()->tokens->each(function($token, $key) {
                $token->delete();
            });

Error :-

Trying to get property 'tokens' of non-object
Jan
07
1 month ago
Activity icon

Awarded Best Reply on Laravel Queue - Dispatch Method

@bobbybouwmann

Thanks for your reply.

Actually the problem was in .env file. I initialised QUEUE_CONNECTION=database before QUEUE_CONNECTION=sync (default), thus overriding.

php artisan queue:work does show status of process when the processing starts and when it's completed. - I am using laravel 5.8 (maybe that's why)

Activity icon

Replied to Laravel Queue - Dispatch Method

@bobbybouwmann

Thanks for your reply.

Actually the problem was in .env file. I initialised QUEUE_CONNECTION=database before QUEUE_CONNECTION=sync (default), thus overriding.

php artisan queue:work does show status of process when the processing starts and when it's completed. - I am using laravel 5.8 (maybe that's why)

Activity icon

Started a new Conversation Laravel Queue - Dispatch Method

I have used following code in controller :-

dispatch(new SendEmail());

where SendEmail implements ShouldQueue. It contains handle method which sends an email.

Now, I run following command in terminal :-

php artisan queue:work

When the controller runs, dispatch method does execute and an email is sent as required. But the terminal doesn't show any response for the mentioned command.

Jan
04
1 month ago
Activity icon

Started a new Conversation How Would You Create A File On Amazon S3 And Write The Contents To It?

I want to create a file dynamically on the s3 storage and write contents to it. I am already uploading files from client side to s3. So, connecting to s3 is not an issue.

Activity icon

Started a new Conversation Laravel-dompdf - Save File To S3 Not Working

package used - https://github.com/barryvdh/laravel-dompdf

$pdf = PDF::loadView('examples.examplePdf',$data)->setOptions(['defaultPaperSize', 'a4']);

                    $dir = 'examples';
                    Storage::makeDirectory($dir);
                    
                    $path = Storage::disk('s3')->putFileAs(
                        $dir,
                        $pdf->output(),
                        'example.pdf'
                    );

This throws error :-

message: "Call to a member function getRealPath() on string"

Dec
24
2 months ago
Activity icon

Started a new Conversation Is Character "&" Allowed In An Email Address?

For example :- abc&[email protected] Is this a valid email address? Should it be allowed?

Dec
23
2 months ago
Activity icon

Started a new Conversation Laravel-dompdf - Table, Tr, Td Height

I am using the package - https://github.com/barryvdh/laravel-dompdf

I want know how to set height of tr or td while making pdf

Dec
20
2 months ago
Activity icon

Started a new Conversation 1215 - Cannot Add Foreign Key Constraint - PHPMyAdmin - MySql

I am getting this error while importing a table sql file :-

#1215 - Cannot add foreign key constraint

I have already disabled foreign key checks with following :-

SET GLOBAL FOREIGN_KEY_CHECKS=0;

Dec
17
2 months ago
Activity icon

Awarded Best Reply on XAMPP Server - Access From Another Computer On Same Wifi - Windows 10

Had followed steps but, firewall was blocking the connections. Disabled apache tcp rule in inbound rules and added a new rule for allowing all connections on port 80. Now it's working.

Activity icon

Replied to XAMPP Server - Access From Another Computer On Same Wifi - Windows 10

Had followed steps but, firewall was blocking the connections. Disabled apache tcp rule in inbound rules and added a new rule for allowing all connections on port 80. Now it's working.

Activity icon

Started a new Conversation XAMPP Server - Access From Another Computer On Same Wifi - Windows 10

I want to connect to my XAMPP server from another computer on same Wifi.

OS - Windows 10

Dec
15
2 months ago
Activity icon

Awarded Best Reply on Selectize.js - Value Added But UI Not Getting Updated

Hi,

I was returning wrong keys in callback. It should have been id and name, as mentioned in valueField and labelField.

Activity icon

Replied to Selectize.js - Value Added But UI Not Getting Updated

Hi,

I was returning wrong keys in callback. It should have been id and name, as mentioned in valueField and labelField.

Activity icon

Replied to Selectize.js - Value Added But UI Not Getting Updated

$select_city3 = $('#city_id').selectize({
            valueField: 'id',
            labelField: 'name',
            searchField: ['name'],
            load: function(query, callback) {
                if (!query.length && query.length < 3) return callback();
                $.ajax({
                    url: "{{ route('city-list-ajax') }}",
                    type: 'POST',
                    dataType: 'json',
                    error: function() {
                        callback();
                    },
                    success: function(results) {
                        callback(results);
                    }
                });
            },
            create: function(query, callback){
                if($('#state_id').val()){
                    var data={state_id:$('#state_id').val(), city:query};
                } else{
                    alert('Select Country and State first');
                }
                $.ajax({
                    url: '{{url('')}}/add-city',
                    type: 'POST',
                    data:data,
                    success: function (result) {
                        if (result) {
                            callback({ value: result, text: query });

                            $('#city_id').val(result);
                        }
                    }
                });
            }
        });

Above is the full code of selectize initialization on city_id. The return value of result is an id generated for that city. state_id val is only checked for presence as it is required to be passed to database while adding city.

Activity icon

Started a new Conversation Selectize.js - Value Added But UI Not Getting Updated

In selectize.js library, I used the create method to add a new option dynamically to the database.

create: function(query, callback){
                if($('#state_id').val()){
                    var data={state_id:$('#state_id').val(), city:query};
                } else{
                    alert('Select Country and State first');
                }
                $.ajax({
                    url: '{{url('')}}/add-city',
                    type: 'POST',
                    data:data,
                    success: function (result) {
                        if (result) {
                            callback({ value: result, text: query });
                            
                            $('#city_id').val(result);
                        }
                    }
                });
            }

The new option is added to the database but it doesn't appear and/or get selected in the UI.

Dec
11
2 months ago
Activity icon

Awarded Best Reply on Laravel Validator On Numeric Array

I found out that it is possible.

$validator = Validator::make($request->all(), [
            0 => 'required|unique:posts|max:255',
            1 => 'required',
]);
Activity icon

Replied to Laravel Validator On Numeric Array

I found out that it is possible.

$validator = Validator::make($request->all(), [
            0 => 'required|unique:posts|max:255',
            1 => 'required',
]);
Activity icon

Started a new Conversation Laravel Validator On Numeric Array

For applying validation on request fields, I know the following :-

$validator = Validator::make($request->all(), [
            'title' => 'required|unique:posts|max:255',
            'body' => 'required',
        ]);

Can this be done when using a custom numeric array like :- ['Some title value','Some body value']

The validation should be based on numeric indexes instead of named indexes.

Is this possible?

Dec
04
2 months ago
Activity icon

Replied to Implode(): Invalid Arguments Passed

If the wadah_id input is "2,3" then no need to call implode, as it is already converted to comma separated string.

Dec
03
2 months ago
Activity icon

Replied to Implode(): Invalid Arguments Passed

Have you tried dd($request->wadah_id); and saw if the input is an array?

Activity icon

Replied to Illuminate \ Database \ QueryException (42S22) SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column 'distributor_other_infos.dist.dist_company_ho' In 'on Clause' (SQL: Select * From `distributor_other_infos` Inner Join `head_offices` On `distributor_oth

Maybe you meant,

->join('head_offices','distributor_other_infos.dist_company_ho','=','head_offices.head_office_id')

instead of

->join('head_offices','distributor_other_infos.dist.dist_company_ho','=','head_offices.head_office_id')

Activity icon

Started a new Conversation Collections - Each Method

While iterating through each item, I want to remove the item from collection if a certain condition is met.

For ex.

$collection->each(function ($item, $key) {
    if(!$item->active_flag){
        //remove the item from collection
    }
});

For Array, we use unset method. But, what should I use in this case?

Dec
02
2 months ago
Activity icon

Awarded Best Reply on Bootstrap Datepicker 1.9.0 - Jquery

Hi Nakov,

Thanks for your reply.

Unfortunately, your solution didn't work in my version. Maybe because of version compatibility (as version 1.9.0 also could not be latest).

For me, I did the following to get it work :-

$("#from_date").datepicker({ autoclose: true, }); $("#to_date").datepicker({ autoclose: true });

$('#from_date').bind('changeDate', function(selected){

$("to_date").datepicker('destroy');
        
$("#to_date").datepicker({
    autoclose: true,
    startDate: selected.date
    });

});

$('#to_date').bind('changeDate', function(selected){

$("#from_date").datepicker('destroy');

$("#from_date").datepicker({
    autoclose: true,
    endDate: selected.date
        });

});

Activity icon

Replied to Bootstrap Datepicker 1.9.0 - Jquery

Hi Nakov,

Thanks for your reply.

Unfortunately, your solution didn't work in my version. Maybe because of version compatibility (as version 1.9.0 also could not be latest).

For me, I did the following to get it work :-

$("#from_date").datepicker({ autoclose: true, }); $("#to_date").datepicker({ autoclose: true });

$('#from_date').bind('changeDate', function(selected){

$("to_date").datepicker('destroy');
        
$("#to_date").datepicker({
    autoclose: true,
    startDate: selected.date
    });

});

$('#to_date').bind('changeDate', function(selected){

$("#from_date").datepicker('destroy');

$("#from_date").datepicker({
    autoclose: true,
    endDate: selected.date
        });

});

Dec
01
2 months ago
Activity icon

Started a new Conversation Bootstrap Datepicker 1.9.0 - Jquery

I want to implement "from" and "to" date range logic.

$("#from_date").datepicker({ autoclose: true }); $("#to_date").datepicker({ autoclose: true });

When from_date is selected, the to_date available to select must be equal to or greater than from_date. When to_date is selected, the from_date available to select must be equal to or less than to_date.

I tried setting startDate and endDate of options in datepicker when changeDate event is fired, but there is no change that occurs.

The code snippets I have found on searching on Google is old.

Nov
29
2 months ago
Activity icon

Started a new Conversation Javascript Front End Regular Expressions

Can anyone share regular expressions in JavaScript to validate common input fields like email and website URL?

Nov
22
3 months ago
Activity icon

Replied to Where Are You All From?

Mumbai, India

Activity icon

Awarded Best Reply on Laravel 6 - Passport Package Installation

I installed earlier version of Passport (v7.5.1). It got installed without errors.

Activity icon

Replied to Laravel 6 - Passport Package Installation

I installed earlier version of Passport (v7.5.1). It got installed without errors.

Nov
21
3 months ago
Activity icon

Started a new Conversation Laravel 6 - Passport Package Installation

i have a Laravel 6 project. I am trying to setup laravel passport package. On "composer require laravel/passport" I get following response :-

Using version ^8.0 for laravel/passport ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1 - Installation request for league/oauth2-server (locked at 7.4.0) -> satisfiable by league/oauth2-server[7.4.0]. - laravel/passport 8.x-dev requires league/oauth2-server ^8.0 -> satisfiable by league/oauth2-server[8.0.0]. - laravel/passport v8.0.0 requires league/oauth2-server ^8.0 -> satisfiable by league/oauth2-server[8.0.0]. - laravel/passport v8.0.1 requires league/oauth2-server ^8.0 -> satisfiable by league/oauth2-server[8.0.0]. - Conclusion: don't install league/oauth2-server 8.0.0 - Installation request for laravel/passport ^8.0 -> satisfiable by laravel/passport[8.x-dev, v8.0.0, v8.0.1].

Installation failed, reverting ./composer.json to its original content.

How to solve this problem?