kvithalani

kvithalani

Member Since 1 Year Ago

Experience Points
4,350
Total
Experience

650 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
5
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
4,350 XP
18 Feb
7 months ago

kvithalani left a reply on Reference Two Columns On Another Table Or Reference The Id?

@midwestdev Suppose you are creating this for any user like anyone wants to loose his/her weight then you want to display that formula_item which ingredients exclude the loose weight right?? Or at the it of create new formula_item you want to show only those ingredient which excludes the loose weight? ?

kvithalani left a reply on How To Solve This? Undefined Offset: 0 (View:)

@anonymouse703

please post your query from which you got this response

06 Feb
7 months ago

kvithalani left a reply on How To Click Button Inside In A Table Row In Modal?

Give Id tho that button with id like : #delButton + id; Example HTML:

<button id="delButton{{id}}">Delete</button>

JS:

$('#delButton + id).on('click',function(){
...
...
});

28 Jan
7 months ago

kvithalani left a reply on Help With Sync Method Of Many Relationship

@socieboy Is version third field of your pivot table?

And why you want to make it like that?

If you have multiple fields in pivot table and you need to use sync method to update it then just pass data in json it will take data automatically.

See here I have multiple fields. Like, brand_id, product_id, price, discount, start_time, end_time. For this I just pass it json and pass it to the sync method Like this way:

Here is the code:

$product = Product::find($id);
$brands = $input['brands'];
             foreach($brands as &$brand) {
               $brand['start_time'] = date('Y-m-d H:i:s', strtotime($brand['start_time']));
               $brand['end_time'] = date('Y-m-d H:i:s', strtotime($brand['end_time']));
               unset($brand['brand']);
             }
             Log::info($brands);

Here is log of brands array:

array (
  8 => 
  array (
    'brand_id' => '8',
    'price' => '20000.00',
    'discount' => '10.00',
    'start_time' => '2018-11-29 12:12:00',
    'end_time' => '2018-12-27 00:12:00',
  ),
  'brand2' => 
  array (
    'brand_id' => '7',
    'price' => '1200.00',
    'discount' => '1.00',
    'start_time' => '2019-01-29 11:11:00',
    'end_time' => '2019-02-01 00:12:00',
  ),
)  

I hope it will helpful to you!

Thanks!

24 Jan
7 months ago

kvithalani left a reply on Get Data From Controller Each Second

You may use cron-job for it.

here is the link for more info: https://laravel.com/docs/5.7/scheduling

I hope it will helpful to you.

kvithalani left a reply on How To Show Multiple Selected Data While Editing In Drop Down Using Selectize In Laravel?

Do you want to display multiple selected item and also unselected item into the list right? if yes then you may do like this:

<select class="form-control selectpicker" data-live-search="true" multiple placeholder="Subject" name="subjects[]" id="subject">
              @foreach($subjects as $sub)
                <option value="{{ $sub->id }}"   @foreach($item->subjectlist as $sublist){{$sublist->pivot->subject_id == $sub->id ? 'selected': ''}}   @endforeach> {{ $sub->name }}</option>
              @endforeach
            </select>

Try this code. i hope it will be helpful!

10 Dec
9 months ago

kvithalani left a reply on Access Env Variable Inside Js File

@fredemagi Sorry, There is one syntax error I have used same quotation Try this:

var max_val = "{{ env('MIX_MY_VAR') }}";
console.log(max_val );

kvithalani left a reply on Access Env Variable Inside Js File

@fredemagi You may access it like this,


var max_val = '{{ env('MIX_MY_VAR') }}';
console.log(max_val);

if you have just added this MIX_MY_VAR in env and didn't clear config cache then first clear it,

php artisan config:clear
php artisan cache:clear
composer dump-autoload
php artisan view:clear
php artisan route:clear

kvithalani left a reply on How To Open List Where Parent_id 1

@irankhosravi you may display only main categories in category list like,

  $categories = Category::orderBy('id', 'desc')->where('parent_id', 0)->get();

And then, when user click on edit or view button it will display main category detail with it's sub categories. Like,

$category = Category::find($id);
$subCategory = Category::where('parent_id' , $id)->get();
return view('category.view', compact('category', 'subCategory'));

kvithalani left a reply on How To Display Name In Nav Bar From Db

@abdulbazith First, you need to check user is logged in or not and then you may print name of the logged in user like this, And also you need to make relationship between user table and personal_details table if it is stored is diff tables.

@if(auth()->user())
 {{ auth()->user()->personal_details->first_name }}
@endif

kvithalani left a reply on After Login User, Redirect To Specific Path

@sanjayacloud Yeah as palak says you may override the inbuilt method of auth so that first you need to change in LoginController:

use Illuminate\Http\Request;
use Auth;

public function authenticated(Request $request, $user) {
  if(Auth::user()->role->name=='admin'){
    return redirect('/admin/dashboard');
  }else{
    return redirect('/dashboard');
  }
}

08 Dec
9 months ago

kvithalani left a reply on Usage Of Laravelcollective/HTML In 5.7

@wienhoefer From my point of view you may use Laravelcollective/HTML. You can refer this link. so you will get better idea about it.

https://stackoverflow.com/questions/50928896/what-is-the-advantage-of-using-laravelcollective-html-component-over-using-the-r

kvithalani started a new conversation Angular Theme For Web App Development

Hello, guys can anyone suggest me a very good theme in angular. My web app will use only in mobile so does anyone knows a good theme which works in i-phone and android phone very well.

07 Dec
9 months ago

kvithalani left a reply on Add/Edit Form

@speedydan Do this:

<input type="checkbox" id="productIsActive" name="is_active" {{ old('is_active', @$product? $product->is_active: true) ? 'checked': '' }}>

kvithalani left a reply on Add/Edit Form

@speedydan you may do like this:

<input type="text" class="form__input" id="legal_name" name="legal_name" value="{{ old('name', @$fields->legal_name }}" >

06 Dec
9 months ago

kvithalani left a reply on Role Permission Laravel

Thanks Everyone for the response. I will use it!!

05 Dec
9 months ago

kvithalani started a new conversation Role Permission Laravel

Can anyone suggest me a good package for role permission in laravel. Thanks in advance...!!

kvithalani left a reply on Uncaught TypeError: Illegal Invocation

@jaythanki yeah I have check it. But it was not worked. So I did it without AJAX call.

04 Dec
9 months ago

kvithalani left a reply on Uncaught TypeError: Illegal Invocation

@jaythanki I have added it. Still not working. same error

kvithalani started a new conversation Uncaught TypeError: Illegal Invocation

Hello guys,

I am trying to store image using AJAX call in laravel. While I am requesting it is giving me an error of JQuery. I want to store my image on S3 bucket. I have done:

HTML code:

<input type="file" class="" name="image" id="image{{$sub->id}}" accept="image/*">
<button type="button" class="btn btn-success updateVal" id="update" value="{{$sub->id}}">Update</button>

JS code:

$('.updateVal').click(function() {
 var id = $(this).val();
 var parent_id = "{{$productAttributeValue->id}}";
 var valueType = 'sub';
 var _token = $('input[name="_token"]').val();
 var subValue = $('#value'+id).val();
 var subValImage = $('#image'+id).val();
 var theFormFile = $('#image'+id).get()[0].files[0];
 console.log(theFormFile);
 var data = {_token: _token, mainVlaue: parent_id, valueType: valueType, value: subValue, image: theFormFile, id:id, _method: 'PUT'};
 console.log(data);
       $.ajax({
           url: '/admin/update/sub-product-attribute-value/'+id,
           type: 'PUT',
           data: data,
           dataType: 'json',
           success:function(response)
           {
             if(response.code == 200) {
               window.location.reload();
             } else {

             }
              //
           }, error: function(response) {
             alert(response);
           }
           });
});

I got one solution that give this -> processData: false, into AJAX request. But it is not passing data in request at laravel side. Can anyone knows another solution. Thanks in advance..

21 Nov
10 months ago

kvithalani left a reply on How To Clear The Cart Value After Checkout?

@Ashraam thanks for the reply. I have used it. got the solution.


session()->forget('cart');

kvithalani started a new conversation How To Clear The Cart Value After Checkout?

I have used laravel session for cart. I have done cart and checkout now how do I clear the cart value after checkuot? Thanks in advance

20 Nov
10 months ago

kvithalani left a reply on Many To Many Relationship

@paduraruionutandrei I think you must have one product table, one order table and another is order_line table. Product table will be independent. Order table will also be independent and order_line has order_id and product_id and also you may add another field like total_qty etc. I guess this will be easy for you. If you like then try this way. I hope it will work!!

19 Nov
10 months ago

kvithalani left a reply on Singleton Class Can't Resolve From Controller Constructor

@harit Have you added your middleware in


$routesMiddlewareGroup of app/Http/Kernel.php file

kvithalani left a reply on Country-State-City Package

@tisuchi thank for the reply. I have tried your suggested packages but can you tell me how do I get cities of selected state via ->https://github.com/antonioribeiro/countries this package. And yeah another package only gives country and state.

kvithalani started a new conversation Country-State-City Package

Can anyone suggest me a good package to get country, state and city in laravel. Thanks in advance.

kvithalani left a reply on Bootstrap Class Wizard And Nav-content Not Working

@skoyah bootstrap inbuilt class tab-content and wizard is not working in my laravel file

16 Nov
10 months ago

kvithalani started a new conversation Bootstrap Class Wizard And Nav-content Not Working

Here is my code, I don't know what's wrong with it can anyone helps me....

@extends('layouts.product-header')
@section('content')
    <!-- start product details -->

    <section>
        <div class="container">
            <div class="row justify-content-center">
                <div class="col">
                    <h1 class="h2 mb-2">Checkout</h1>
                    <span>You have (<span>2</span>) products in your cart.</span>
                </div>
                <!--end of col-->
            </div>
        </div>
    </section>
    <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
    <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
    <section class="flush-with-above">
        <div class="container">
            <div class="row">
                <div class="col-lg-8">
                    <div class="my-5 ">
                      <form class="" method="POST" action="" id="customerForm" name="customerForm" enctype="multipart/form-data" data-toggle="validator">
                        {{ csrf_field() }}
                        <ul class="row mb-5 nav nav-tabs text-center">
                            <li class="col-3"><a href="#first" class="step-circle step-circle-sm">1</a>
                            </li>
                            <li class="col-3"><a href="#second" class="step-circle step-circle-sm">2</a>
                            </li>
                            <li class="col-3"><a href="#third" class="step-circle step-circle-sm">3</a>
                            </li>
                            <li class="col-3"><a href="#fourth" class="step-circle step-circle-sm">4</a>
                            </li>
                        </ul>
                        <!--end of col-->

                        <div class="tab-content">
                            <div id="first">
                                <div class="card card-lg">
                                    <div class="card-body">
                                        <h5>Personal Information</h5>
                                        <p>Aenean ut tellus tellus. Suspendisse potenti. Nullam tincidunt <br> lacus
                                            tellus, sed aliquam est vehicula a.</p>

                                        <form class="row">
                                            <div class="form-group col-lg-6">
                                                <label>First Name</label>
                                                <input type="text" class="form-control" name="first_name" id="" placeholder="">
                                            </div>

                                            <div class="form-group col-lg-6">
                                                <label>Last Name</label>
                                                <input type="text" class="form-control" name="last_name" id="" placeholder="">
                                            </div>

                                            <div class="form-group col-lg-6">
                                                <label>Email Address</label>
                                                <input type="text" class="form-control" name="email" id="" placeholder="">
                                            </div>

                                            <div class="form-group col-lg-6">
                                                <label>Phone Number</label>
                                                <input type="text" class="form-control" name="phone_number" id="" placeholder="">
                                            </div>
                                        </form>

                                        <button class="btn btn-success sw-btn-next mt-4" type="button">Next Step</button>
                                    </div>
                                </div>
                            </div>
                            <div id="second">
                                <div class="card card-lg">
                                    <div class="card-body">
                                        <h5>Billing Address</h5>
                                        <p>Aenean ut tellus tellus. Suspendisse potenti. Nullam tincidunt <br> lacus
                                            tellus, sed aliquam est vehicula a.</p>
                                        <form class="row">
                                            <div class="col-lg-12 mb-3">
                                                <div class="custom-control custom-checkbox">
                                                    <input type="checkbox" class="custom-control-input" id="customCheck1">
                                                    <label class="custom-control-label" for="customCheck1">Billing
                                                        address &amp; Shipping address is same.</label>
                                                </div>
                                            </div>

                                            <div class="form-group col-lg-12">
                                                <label>Address</label>
                                                <input type="text" class="form-control" name="address1" id="" placeholder="">
                                            </div>

                                            <div class="form-group col-lg-12">
                                                <label>Address 2 (Optional)</label>
                                                <input type="text" class="form-control" name="address2" id="" placeholder="">
                                            </div>

                                            <div class="form-group col-lg-4">
                                                <label>Country</label>
                                                <select class="form-control" name="country" id="">
                                                    <option>1</option>
                                                    <option>2</option>
                                                    <option>3</option>
                                                </select>
                                            </div>

                                            <div class="form-group col-lg-4">
                                                <label>State</label>
                                                <select class="form-control" name="state" id="">
                                                    <option>1</option>
                                                    <option>2</option>
                                                    <option>3</option>
                                                </select>
                                            </div>

                                            <div class="form-group name="zip" col-lg-4">
                                                <label>ZIP</label>
                                                <input type="text" class="form-control" id="" placeholder="">
                                            </div>
                                        </form>

                                        <button class="btn btn-success sw-btn-next mt-4" type="button">Next Step</button>
                                    </div>
                                </div>
                            </div>
                            <div id="third">
                                <div class="card card-lg">
                                    <div class="card-body">
                                        <h5>Choose your Payment Method</h5>
                                        <p>Aenean ut tellus tellus. Suspendisse potenti. Nullam tincidunt <br> lacus
                                            tellus, sed aliquam est vehicula a.</p>

                                        <div class="form-group">

                                            <div class="checkbox">
                                                <label data-toggle="collapse" data-target="#collapseOne" aria-expanded="false"
                                                    aria-controls="collapseOne">
                                                    <input type="checkbox" /> Net Banking
                                                </label>
                                            </div>
                                        </div>
                                        <div id="collapseOne" aria-expanded="false" class="collapse">
                                            <div class="well">Lorem ipsum dolor sit amet, consectetur adipisicing elit.
                                                Saepe ut molestias eius, nam neque esse eos modi corrupti harum fugit,
                                                hic recusandae praesentium, minima ipsa eligendi architecto at! Culpa,
                                                explicabo.</div>
                                        </div>
                                        <div class="form-group">
                                            <div class="checkbox">
                                                <label data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false"
                                                    aria-controls="collapseTwo">
                                                    <input type="checkbox" /> Credit Card / Debit Card
                                                </label>
                                            </div>
                                        </div>
                                        <div id="collapseTwo" aria-expanded="false" class="collapse ">
                                            <div class="well">
                                                <p>Safe money transfer using your bank account.
                                                    Safe payment online. Credit card needed. Visa,
                                                    Maestro, Discover, American Express</p>

                                                <div class="card-wrapper"></div>

                                                <div class="form-container active">
                                                    <form action="" class="row">
                                                        <div class="form-group col-lg-12">
                                                            <label>Card Number</label>
                                                            <input placeholder="Card number" type="tel" name="number"
                                                                class="form-control">
                                                        </div>
                                                        <div class="form-group col-lg-6">
                                                            <label>Card Holder</label>
                                                            <input placeholder="Full name" type="text" name="name"
                                                                class="form-control">
                                                        </div>
                                                        <div class="form-group col-lg-3">
                                                            <label>Expiry Date</label>
                                                            <input placeholder="MM/YY" type="tel" name="expiry" class="form-control">
                                                        </div>
                                                        <div class="form-group col-lg-3">
                                                            <label>CVC</label>
                                                            <input placeholder="CVC" type="number" name="cvc" class="form-control">
                                                        </div>

                                                    </form>
                                                </div>

                                            </div>
                                        </div>

                                        <button type="submit" class="btn btn-lg btn-success">Make Payment</button>
                                    </div>
                                </div>
                            </div>
                            <div id="fourth">
                                <div class="card card-lg">
                                    <div class="card-body">
                                        <span>Step Four Content</span>
                                        <br>
                                    </div>
                                </div>
                            </div>
                        </div>
                      </form>
                    </div>
                </div>

                <div class="col-sm-4">
                    <div class="fixme">
                        <h6>Order Summary</h6>
                        <p>Shipping and additional costs are calculated
                            based on values you have entered.</p>

                        <p class="alert alert-success">Add ₹ 5.00 of eligible items to your order to qualify for FREE
                            Shipping. </p>
                        <dl class="dlist-align">
                            <dt>Subtotal</dt>
                            <dd class="text-right">₹ 80,000</dd>
                        </dl>
                        <dl class="dlist-align">
                            <dt>GST (18%)</dt>
                            <dd class="text-right">₹ 6,000</dd>
                        </dl>
                        <dl class="dlist-align">
                            <dt>Discount</dt>
                            <dd class="text-right text-success">- ₹ 5,000</dd>
                        </dl>
                        <hr>
                        <dl class="dlist-align h4">
                            <dt>Total:</dt>
                            <dd class="text-right"><strong>₹ 81,000</strong></dd>
                        </dl>
                    </div>
                </div>
            </div>

        </div>
    </section>
    <script src="{{asset('js/jquery-3.3.1.slim.min.js')}}"></script>
    <script src="{{asset('js/popper.min.js')}}"></script>

    <script src="{{asset('js/bootstrap.js')}}"></script>

    <script src="{{asset('js/jquery.min.js')}}"></script>
    <script src="{{asset('js/flickity.pkgd.min.js')}}"></script>
    <script src="{{asset('js/owl.carousel.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('js/jquery.smartWizard.min.js')}}"></script>
    <script src="{{asset('js/card.js')}}"></script>
    <script>
        $('code').each(function (i, e) {
          hljs.highlightBlock(e)
        });
        var card = new Card({
          form: '.active form',
          container: '.card-wrapper'
        })
    </script>
    <script src="{{ asset('js/script.js') }}"></script>
    <!-- end product details -->


@endsection


12 Nov
10 months ago

kvithalani left a reply on Auth Check Public Folder Php File?

@coder_uzb okay then run,


composer:dumpautoload 
php artisan config:ca
php artisan cache:cl

Or you may refer this solution

https://stackoverflow.com/questions/51817913/unserialize-error-at-offset-0-of-40-bytes-error

kvithalani left a reply on Auth Check Public Folder Php File?

@coder_uzb Have you run this command after update the version:

php artisan key:generate

if no then please run this command may be your problem will solve....

kvithalani left a reply on Auth Check Public Folder Php File?

@coder_uzb I don't know it is possible or not but you may use another way like, You can store file name and user id in one table and from that you can do whatever you want.

02 Nov
10 months ago

kvithalani started a new conversation Group Data In Foreach Loop Which Has Same Id

I have three tables products , product_attributes and product_attribute_values.

 products table has: Id, name, description, image, etc...
product_attributes table has: id, name, etc...
product_attribute_values has: id, product_id, attribute_id, value, etc..

Now, when I pass the product id to url I want product attributes in group. Like I have one product MOBILE which has attribute COLOR and it has three values BLACK, WHITE and GOLD. So, I want to group it by attribute. Can anyone helps me? How can I do it? in query I will get the result or I need to do it with loop? Thanks in advance!!!

kvithalani left a reply on Redundant Code In Controllers?

@INDIEMAN you can make different controller for web and api. Like:

App/Http/Controller/Web/Your Web Controllers
App/Http/Controller/Api/Your Api Controllers

31 Oct
10 months ago

kvithalani left a reply on Laravel Datatables Is Not Installing With Composer

@NAFEEUR10 Have you tried this version:

"require": {
"yajra/laravel-datatables": "^8.5",
}
26 Oct
10 months ago

kvithalani left a reply on How Get Just Id / Name From Relational Model?

@jok3r

 $customers = Customer::where('is_approved', '=', 'approved')->with('brands:id,brand')->select('id','brand_id')->get();
25 Oct
10 months ago

kvithalani left a reply on For Each Loop

@lawkunchi If you have assigned products to user then it will be not null and you will get the data. So can you create new data and assign products to the user and then check it you will get the expected result.

24 Oct
10 months ago

kvithalani left a reply on How Can I Get Username Who Has Same Project With User Logged In

@koriah make sure that your table has proper data. because I got the data. I have implemented same.

kvithalani left a reply on How Can I Get Username Who Has Same Project With User Logged In

@koriah show me your model's method and controller's method which you have done for this.

kvithalani left a reply on How Can I Get Username Who Has Same Project With User Logged In

@koriah do it In User.php (model)

public function user_projects() {
    return $this->belongsToMany(App\Project','user_projects','user_id','projext_id');
}

kvithalani left a reply on How Get Just Id / Name From Relational Model?

@JOK3R

Yes, you can directly select anything in model's method like this:

public function brands() {
 return $this->hasMany(Brand::class, 'fk_uid', 'fk_uid')->select('id','brand');

 }

kvithalani left a reply on How Can I Get Username Who Has Same Project With User Logged In

@KORIAH In User model:

public function user_projects() {
    return $this->belongsToMany('user_projects','user_id','projext_id');
}

your Controller:

$getUsers = User::with('user_projects')->where('id', 'Auth::user()->id')->get();
return view ('teams.index', compact('getUsers'));