Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

sanjayacloud

sanjayacloud

Member Since 2 Years Ago

Experience Points
7,860
Total
Experience

2,140 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
10
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    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 2
7,860 XP
Nov
24
3 days ago
Activity icon

Replied to How To Convert Hours To Minutes

I have simplified it as below.

$dteStart = new DateTime($report->check_in_time);
$dteEnd   = new DateTime($report->check_out_time);
$dteDiff  = $dteStart->diff($dteEnd);
$parts = explode(':',$dteDiff->format("%H:%I"));
$totalMinuts = $parts[0]*60 + $parts[1];

Activity icon

Started a new Conversation How To Convert Hours To Minutes

Hi all,

I want to know How to convert hours with minutes to minutes example as follows

Ex: 04:25 to minutes. Anyone can help me with this?

Nov
21
6 days ago
Activity icon

Replied to How To Use Multiple Date And Time Picker Inputs In Same Form Tempusdominus-bootstrap-4 Datetime Picker

@marianomoreyra This is ok if I use it as it is. But when I dynamically generate as my below code. It's not work

Here is my new blade with dynamic row generate.


@extends('layouts.admin')
@section('styles')
    <!-- Tempusdominus Bootstrap 4 -->
    <link rel="stylesheet" href="{{url('admin/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css')}}">
@endsection

@section('content')
<!-- Main content -->
<div class="content">
    <div class="container">
        <div class="row mt-3 mb-3">
            <div class="col-md-9"></div>
            <div class="col-md-3 text-right">

            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="card card-info">
                    <div class="card-header">
                        <h3 class="card-title">Make new Roster</h3>
                    </div>
                    <div class="card-body">
                    <form method="POST" action="{{url('roster/store')}}">
                        @csrf
                        <div class="row">
                            <form action="" method="post">
                                <div id="dynamic-field-1" class="form-group dynamic-field">
                                    <div class="form-group col-md-6">
                                        <label>Start</label>
                                        <div class="input-group date timepicker1" id="start_dt_1" data-target-input="nearest">
                                            <input type="text" class="form-control datetimepicker-input datetimepicker" data-target="#start_dt_1" name="start_time[]"/>
                                            <span class="input-group-addon" data-target="#start_dt_1" data-toggle="datetimepicker">
              <span class="fa fa-calendar"></span>
            </span>
                                        </div>
                                    </div>
                                    <div class="form-group col-md-6">
                                        <label>End</label>
                                        <div class="input-group date timepicker1" id="end_dt_1" data-target-input="nearest">
                                            <input type="text" class="form-control datetimepicker-input datetimepicker" data-target="#end_dt_1" name="end_time[]"/>
                                            <span class="input-group-addon" data-target="#end_dt_1" data-toggle="datetimepicker">
              <span class="fa fa-calendar"></span>
            </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix mt-4">
                                    <button type="button" id="add-button" class="btn btn-secondary float-left text-uppercase shadow-sm"><i class="fas fa-plus fa-fw"></i> Add</button>
                                    <button type="button" id="remove-button" class="btn btn-secondary float-left text-uppercase ml-1" disabled="disabled"><i class="fas fa-minus fa-fw"></i> Remove</button>
                                    <button type="submit" class="btn btn-primary float-right text-uppercase shadow-sm">Submit</button>
                                </div>
                        </div>
                    </div>
                    <!-- /.card-body -->
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-md-4 offset-4">
                                <button class="btn btn-block bg-gradient-cyan">Submit</button>
                            </div>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- /.content -->
@endsection
@section('scripts')
    <script src="{{url('admin/plugins/moment/moment.min.js')}}"></script>
    <!-- Tempusdominus Bootstrap 4 -->
    <script src="{{url('admin/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js')}}"></script>
    @if(session('success'))
        <script>
            var msg = "{{session('success')}}"
            $( document ).ready(function() {
                $.notify(msg, "success");
                // console.log( "ready!" );
            });
        </script>
    @endif
@parent
    <script>
        $(function () {
            $('.timepicker1').datetimepicker({
                format: 'LT'
            });
        });

        $(document).ready(function() {
            var buttonAdd = $("#add-button");
            var buttonRemove = $("#remove-button");
            var className = ".dynamic-field";
            var count = 0;
            var field = "";
            var maxFields = 5;

            function totalFields() {
                return $(className).length;
            }

            function addNewField() {
                count = totalFields() + 1;
                field = $("#dynamic-field-1").clone();
                field.attr("id", "dynamic-field-" + count);
                field.children("label").text("Field " + count);
                field.find("input").val("");
                $(className + ":last").after($(field));
            }

            function removeLastField() {
                if (totalFields() > 1) {
                    $(className + ":last").remove();
                }
            }

            function enableButtonRemove() {
                if (totalFields() === 2) {
                    buttonRemove.removeAttr("disabled");
                    buttonRemove.addClass("shadow-sm");
                }
            }

            function disableButtonRemove() {
                if (totalFields() === 1) {
                    buttonRemove.attr("disabled", "disabled");
                    buttonRemove.removeClass("shadow-sm");
                }
            }

            function disableButtonAdd() {
                if (totalFields() === maxFields) {
                    buttonAdd.attr("disabled", "disabled");
                    buttonAdd.removeClass("shadow-sm");
                }
            }

            function enableButtonAdd() {
                if (totalFields() === (maxFields - 1)) {
                    buttonAdd.removeAttr("disabled");
                    buttonAdd.addClass("shadow-sm");
                }
            }

            buttonAdd.click(function() {
                addNewField();
                enableButtonRemove();
                disableButtonAdd();
            });

            buttonRemove.click(function() {
                removeLastField();
                disableButtonRemove();
                enableButtonAdd();
            });
        });


    </script>
@endsection

Nov
20
1 week ago
Activity icon

Started a new Conversation How To Use Multiple Date And Time Picker Inputs In Same Form Tempusdominus-bootstrap-4 Datetime Picker

I am trying to make multiple date & time picker input using Bootstrap datetimepicker. But when I click one time input other time inputs will automatically change according to the current time or date input value. Anyone can help me to do this?

View

  <div class="row">
                            <div class="customer_records">
                                <div class="row">
                                    <div class="col-md-6 form-group">
                                        <label>Employee</label>
                                        <select name="employee" class="form-control">
                                            @foreach($employees as $employee)
                                                <option value="{{$employee->id}}" {{old('employee') == $employee->id ? 'selected' : ''}}>{{$employee->name}}</option>
                                            @endforeach
                                        </select>
                                        @if($errors->has('employee'))
                                            <em class="invalid-feedback">
                                                {{ $errors->first('employee') }}
                                            </em>
                                        @endif
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <!-- Date -->
                                        <div class="form-group">
                                            <label>Date:</label>
                                            <div class="input-group date" id="reservationdate1" data-target-input="nearest">
                                                <input type="text" name="date" class="form-control datetimepicker-input" data-target="#reservationdate"/>
                                                <div class="input-group-append" data-target="#reservationdate1" data-toggle="datetimepicker">
                                                    <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                                </div>
                                            </div>
                                            @if($errors->has('date'))
                                                <em class="invalid-feedback">
                                                    {{ $errors->first('date') }}
                                                </em>
                                            @endif
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="bootstrap-timepicker">
                                            <div class="form-group">
                                                <label>Start time</label>
                                                <div class="input-group date" id="timepicker1" data-target-input="nearest">
                                                    <input type="text" name="start_time" class="form-control datetimepicker-input" data-target="#timepicker1"/>
                                                    <div class="input-group-append" data-target="#timepicker1" data-toggle="datetimepicker">
                                                        <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                    </div>
                                                </div>
                                                <!-- /.input group -->
                                                @if($errors->has('start_time'))
                                                    <em class="invalid-feedback">
                                                        {{ $errors->first('start_time') }}
                                                    </em>
                                                @endif
                                            </div>
                                            <!-- /.form group -->
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="bootstrap-timepicker">
                                            <div class="form-group">
                                                <label>End time</label>
                                                <div class="input-group date" id="timepicker2" data-target-input="nearest">
                                                    <input type="text" name="end_time" class="form-control datetimepicker-input" data-target="#timepicker2"/>
                                                    <div class="input-group-append" data-target="#timepicker2" data-toggle="datetimepicker">
                                                        <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                    </div>
                                                </div>
                                                <!-- /.input group -->
                                                @if($errors->has('end_time'))
                                                    <em class="invalid-feedback">
                                                        {{ $errors->first('end_time') }}
                                                    </em>
                                                @endif
                                            </div>
                                            <!-- /.form group -->
                                        </div>
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <label>Service Area</label>
                                        <select name="service_area" class="form-control">
                                            <option value="GRILL" {{old('service_area') == 'GRILL' ? 'selected' : ''}}>GRILL</option>
                                            <option value="PANS" {{old('service_area') == 'PANS' ? 'selected' : ''}}>PANS</option>
                                            <option value="PASS" {{old('service_area') == 'PASS' ? 'selected' : ''}}>PASS</option>
                                            <option value="FRYER" {{old('service_area') == 'FRYER' ? 'selected' : ''}}>FRYER</option>
                                            <option value="KICHAND" {{old('service_area') == 'KICHAND' ? 'selected' : ''}}>KICHAND</option>
                                            <option value="PRP-OVEN" {{old('service_area') == 'PRP-OVEN' ? 'selected' : ''}}>PRP-OVEN</option>
                                            <option value="OVEN" {{old('service_area') == 'OVEN' ? 'selected' : ''}}>OVEN</option>
                                            <option value="DRIVER" {{old('service_area') == 'DRIVER' ? 'selected' : ''}}>DRIVER</option>
                                        </select>
                                        @if($errors->has('service_area'))
                                            <em class="invalid-feedback">
                                                {{ $errors->first('service_area') }}
                                            </em>
                                        @endif
                                    </div>
                                    <div class="col-md-10"></div>
                                </div>
                                <a class="extra-fields-customer" href="#">Add More Customer</a>
                            </div>

                            <div class="customer_records_dynamic"></div>

                        </div>

JS

 //Timepicker
        $('#timepicker1').datetimepicker({
            use24hours: true,
            format: 'HH:mm'
        });
        $('#timepicker2').datetimepicker({
            use24hours: true,
            format: 'HH:mm'
        })


        $('#reservationdate1').datetimepicker({
            // format: 'd-M-yyyy'
            format: 'YYYY-MM-DD',

        });
        $('.extra-fields-customer').click(function() {
            $('.customer_records').clone().appendTo('.customer_records_dynamic');
            $('.customer_records_dynamic .customer_records').addClass('single remove');
            $('.single .extra-fields-customer').remove();
            $('.single').append('<a href="#" class="remove-field btn-remove-customer">Remove Fields</a>');
            $('.customer_records_dynamic > .single').attr("class", "remove");

            $('.customer_records_dynamic .date').each(function() {
                var count = 1;
                // var fieldname = $(this).attr("name");
                var fieldname = $(this).attr('id');
                $(this).attr('id', fieldname + count);
                $(this).attr('data-target', '#'+fieldname + count);
               // console.log($(this).attr('data-target', '#'+fieldname + count));
                $(this).append(" <script>$('#timepicker1'+count).datetimepicker({use24hours: true, format: 'HH:mm'});<\/script>");
                count++;

            });

        });
        $(document).on('click', '.remove-field', function(e) {
            $(this).parent('.remove').remove();
            e.preventDefault();
        });

``

Library : I am trying to make multiple date & time picker input using Bootstrap datetimepicker. But when I click one time input other time inputs will automatically change according to the current time or date input value. Anyone can help me to do this?

View

    <div class="row">
                            <div class="customer_records">
                                <div class="row">
                                    <div class="col-md-6 form-group">
                                        <label>Employee</label>
                                        <select name="employee" class="form-control">
                                            @foreach($employees as $employee)
                                                <option value="{{$employee->id}}" {{old('employee') == $employee->id ? 'selected' : ''}}>{{$employee->name}}</option>
                                            @endforeach
                                        </select>
                                        @if($errors->has('employee'))
                                            <em class="invalid-feedback">
                                                {{ $errors->first('employee') }}
                                            </em>
                                        @endif
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <!-- Date -->
                                        <div class="form-group">
                                            <label>Date:</label>
                                            <div class="input-group date" id="reservationdate1" data-target-input="nearest">
                                                <input type="text" name="date" class="form-control datetimepicker-input" data-target="#reservationdate"/>
                                                <div class="input-group-append" data-target="#reservationdate1" data-toggle="datetimepicker">
                                                    <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                                </div>
                                            </div>
                                            @if($errors->has('date'))
                                                <em class="invalid-feedback">
                                                    {{ $errors->first('date') }}
                                                </em>
                                            @endif
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="bootstrap-timepicker">
                                            <div class="form-group">
                                                <label>Start time</label>
                                                <div class="input-group date" id="timepicker1" data-target-input="nearest">
                                                    <input type="text" name="start_time" class="form-control datetimepicker-input" data-target="#timepicker1"/>
                                                    <div class="input-group-append" data-target="#timepicker1" data-toggle="datetimepicker">
                                                        <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                    </div>
                                                </div>
                                                <!-- /.input group -->
                                                @if($errors->has('start_time'))
                                                    <em class="invalid-feedback">
                                                        {{ $errors->first('start_time') }}
                                                    </em>
                                                @endif
                                            </div>
                                            <!-- /.form group -->
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="bootstrap-timepicker">
                                            <div class="form-group">
                                                <label>End time</label>
                                                <div class="input-group date" id="timepicker2" data-target-input="nearest">
                                                    <input type="text" name="end_time" class="form-control datetimepicker-input" data-target="#timepicker2"/>
                                                    <div class="input-group-append" data-target="#timepicker2" data-toggle="datetimepicker">
                                                        <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                    </div>
                                                </div>
                                                <!-- /.input group -->
                                                @if($errors->has('end_time'))
                                                    <em class="invalid-feedback">
                                                        {{ $errors->first('end_time') }}
                                                    </em>
                                                @endif
                                            </div>
                                            <!-- /.form group -->
                                        </div>
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <label>Service Area</label>
                                        <select name="service_area" class="form-control">
                                            <option value="GRILL" {{old('service_area') == 'GRILL' ? 'selected' : ''}}>GRILL</option>
                                            <option value="PANS" {{old('service_area') == 'PANS' ? 'selected' : ''}}>PANS</option>
                                            <option value="PASS" {{old('service_area') == 'PASS' ? 'selected' : ''}}>PASS</option>
                                            <option value="FRYER" {{old('service_area') == 'FRYER' ? 'selected' : ''}}>FRYER</option>
                                            <option value="KICHAND" {{old('service_area') == 'KICHAND' ? 'selected' : ''}}>KICHAND</option>
                                            <option value="PRP-OVEN" {{old('service_area') == 'PRP-OVEN' ? 'selected' : ''}}>PRP-OVEN</option>
                                            <option value="OVEN" {{old('service_area') == 'OVEN' ? 'selected' : ''}}>OVEN</option>
                                            <option value="DRIVER" {{old('service_area') == 'DRIVER' ? 'selected' : ''}}>DRIVER</option>
                                        </select>
                                        @if($errors->has('service_area'))
                                            <em class="invalid-feedback">
                                                {{ $errors->first('service_area') }}
                                            </em>
                                        @endif
                                    </div>
                                    <div class="col-md-10"></div>
                                </div>
                                <a class="extra-fields-customer" href="#">Add More Customer</a>
                            </div>

                            <div class="customer_records_dynamic"></div>

                        </div>

JS

 //Timepicker
        $('#timepicker1').datetimepicker({
            use24hours: true,
            format: 'HH:mm'
        });
        $('#timepicker2').datetimepicker({
            use24hours: true,
            format: 'HH:mm'
        })


        $('#reservationdate1').datetimepicker({
            // format: 'd-M-yyyy'
            format: 'YYYY-MM-DD',

        });
        $('.extra-fields-customer').click(function() {
            $('.customer_records').clone().appendTo('.customer_records_dynamic');
            $('.customer_records_dynamic .customer_records').addClass('single remove');
            $('.single .extra-fields-customer').remove();
            $('.single').append('<a href="#" class="remove-field btn-remove-customer">Remove Fields</a>');
            $('.customer_records_dynamic > .single').attr("class", "remove");

            $('.customer_records_dynamic .date').each(function() {
                var count = 1;
                // var fieldname = $(this).attr("name");
                var fieldname = $(this).attr('id');
                $(this).attr('id', fieldname + count);
                $(this).attr('data-target', '#'+fieldname + count);
               // console.log($(this).attr('data-target', '#'+fieldname + count));
                $(this).append(" <script>$('#timepicker1'+count).datetimepicker({use24hours: true, format: 'HH:mm'});<\/script>");
                count++;

            });

        });
        $(document).on('click', '.remove-field', function(e) {
            $(this).parent('.remove').remove();
            e.preventDefault();
        });

I am using "https://tempusdominus.github.io/bootstrap-4/" library.
Activity icon

Replied to How To Use Multiple Date And Time Picker Inputs In Same Form (Bootstrap Datetimepicker)

Can I know how to initialize date-time picker in that input?

Activity icon

Replied to How To Use Multiple Date And Time Picker Inputs In Same Form (Bootstrap Datetimepicker)

Its pick date with time. I want to pick only time.

Nov
19
1 week ago
Activity icon

Replied to How To Use Multiple Date And Time Picker Inputs In Same Form (Bootstrap Datetimepicker)

No. This row will create dynamiclly. I cannot hard code like this.

Activity icon

Started a new Conversation How To Use Multiple Date And Time Picker Inputs In Same Form (Bootstrap Datetimepicker)

Hi Guys,

I am trying to make multiple date & time picker input using Bootstrap datetimepicker. But when I click one time input other time inputs will automatically change according to the current time or date input value. Anyone can help me to do this?

View

<form method="POST" action="{{url('admin/expense/store')}}">
                        @csrf
                            <div class="row">
                                <div class="col-md-6 form-group">
                                    <label>Employee</label>
                                    <select name="employee" class="form-control">
                                        @foreach($employees as $employee)
                                            <option value="{{$employee->id}}" {{old('employee') == $employee->id ? 'selected' : ''}}>{{$employee->name}}</option>
                                        @endforeach
                                    </select>
                                    @if($errors->has('employee'))
                                        <em class="invalid-feedback">
                                            {{ $errors->first('employee') }}
                                        </em>
                                    @endif
                                </div>
                                <div class="col-md-6 form-group">
                                    <!-- Date -->
                                    <div class="form-group">
                                        <label>Date:</label>
                                        <div class="input-group date" id="reservationdate1" data-target-input="nearest">
                                            <input type="text" name="date" class="form-control datetimepicker-input" data-target="#reservationdate"/>
                                            <div class="input-group-append" data-target="#reservationdate1" data-toggle="datetimepicker">
                                                <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                            </div>
                                        </div>
                                        @if($errors->has('date'))
                                            <em class="invalid-feedback">
                                                {{ $errors->first('date') }}
                                            </em>
                                        @endif
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="bootstrap-timepicker">
                                        <div class="form-group">
                                            <label>Start time</label>
                                            <div class="input-group date timepicker1"  data-target-input="nearest">
                                                <input type="text" name="start_time" class="form-control datetimepicker-input" data-target=".timepicker1"/>
                                                <div class="input-group-append" data-target=".timepicker1" data-toggle="datetimepicker">
                                                    <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                </div>
                                            </div>
                                            <!-- /.input group -->
                                            @if($errors->has('start_time'))
                                                <em class="invalid-feedback">
                                                    {{ $errors->first('start_time') }}
                                                </em>
                                            @endif
                                        </div>
                                        <!-- /.form group -->
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="bootstrap-timepicker">
                                        <div class="form-group">
                                            <label>End time</label>
                                            <div class="input-group date timepicker1" id="timepicker2" data-target-input="nearest">
                                                <input type="text" name="end_time" class="form-control datetimepicker-input" data-target=".timepicker1"/>
                                                <div class="input-group-append" data-target=".timepicker1" data-toggle="datetimepicker">
                                                    <div class="input-group-text"><i class="far fa-clock"></i></div>
                                                </div>
                                            </div>
                                            <!-- /.input group -->
                                            @if($errors->has('end_time'))
                                                <em class="invalid-feedback">
                                                    {{ $errors->first('end_time') }}
                                                </em>
                                            @endif
                                        </div>
                                        <!-- /.form group -->
                                    </div>
                                </div>
                                <div class="col-md-6 form-group">
                                    <label>Service Area</label>
                                    <select name="service_area" class="form-control">
                                        <option value="GRILL" {{old('service_area') == 'GRILL' ? 'selected' : ''}}>GRILL</option>
                                        <option value="PANS" {{old('service_area') == 'PANS' ? 'selected' : ''}}>PANS</option>
                                        <option value="PASS" {{old('service_area') == 'PASS' ? 'selected' : ''}}>PASS</option>
                                        <option value="FRYER" {{old('service_area') == 'FRYER' ? 'selected' : ''}}>FRYER</option>
                                        <option value="KICHAND" {{old('service_area') == 'KICHAND' ? 'selected' : ''}}>KICHAND</option>
                                        <option value="PRP-OVEN" {{old('service_area') == 'PRP-OVEN' ? 'selected' : ''}}>PRP-OVEN</option>
                                        <option value="OVEN" {{old('service_area') == 'OVEN' ? 'selected' : ''}}>OVEN</option>
                                        <option value="DRIVER" {{old('service_area') == 'DRIVER' ? 'selected' : ''}}>DRIVER</option>
                                    </select>
                                    @if($errors->has('service_area'))
                                        <em class="invalid-feedback">
                                            {{ $errors->first('service_area') }}
                                        </em>
                                    @endif
                                </div>
                            </div>
                    </div>
                    <!-- /.card-body -->
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-md-4 offset-4">
                                <button class="btn btn-block bg-gradient-cyan">Submit</button>
                            </div>
                        </div>
                        </form>

JS


        //Timepicker
        $('.timepicker1').datetimepicker({
            multitime: true,
            use24hours: true,
            format: 'HH:mm'
        });
 

        $('#reservationdate1').datetimepicker({
            // format: 'd-M-yyyy'
            format: 'YYYY-MM-DD',
        });

I am using this plugin.

<script src="{{url('admin/plugins/moment/moment.min.js')}}"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="{{url('admin/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js')}}"></script>
Nov
18
1 week ago
Activity icon

Replied to Video Streaming For E-Learning Website

Thanks. Will go through this. But this video is not free right?

Activity icon

Started a new Conversation Video Streaming For E-Learning Website

Hi all,

Anybody can help me, how to make a live video stream for e-learning using Laravel. Does anyone have an idea?

Please note: This is for E-learning Website.

Nov
08
2 weeks ago
Activity icon

Replied to Clicksend Pagination Does Not Work On Laravel

Hi, I have sorted out this with StackOverflow answer. Nad you have got wrong my question. Anyway, I have sorted out this already.

Nov
07
2 weeks ago
Activity icon

Replied to How Validate Special Characters In Validation

Now I have "preg_match(): Unknown modifier '''", exception: "ErrorException" error. I think it's my fault. But I am not an expert in the regex. Can you help me no this?

"regex:^([^'!'\*\]*)$",
Activity icon

Replied to How Validate Special Characters In Validation

When I use 'alpha_num', It does not allow space and (). I only don't want to allow ", !, *,', \ charactors

Activity icon

Replied to How Validate Special Characters In Validation

I don't want to allow them.

Activity icon

Started a new Conversation How Validate Special Characters In Validation

Hi Guys,

Can anyone help me to validate special characters like ", !, *,', \ kind of characters in the validation?

Nov
05
3 weeks ago
Activity icon

Started a new Conversation Clicksend Pagination Does Not Work On Laravel

Hi Guys, I am working on getting messages history from ClickSend API, I am trying to message from it API as there documentation. But pagination doesn't work. It's only getting the first 15 recorded. Not getting page number as parameter what I send it. Anyone know how does it do? Can I know where I am wrong?

This is my controller Method.

    public function index(Request $request)
    {
        $config = ClickSend\Configuration::getDefaultConfiguration()
            ->setUsername('user-name')
            ->setPassword('password');

        $apiInstance = new ClickSend\Api\SMSApi(new GuzzleHttp\Client(),$config);
        $page = $request->page ? $request->page: 1; // int | Page number
        $limit = 10; // int | Number of records per page

        try {

            $result = $apiInstance->smsHistoryGet($page, $limit);
            $dt = json_decode($result);
            $current_page = $dt->data;
            $current_page = $current_page->current_page;
            $next_page = $current_page+1;
            $prev_page = $current_page == 1 ? null : $current_page-1;
            $allMessages = $dt->data->data;
            return response()->json(['data' => view('staff.history.table', compact('allMessages', 'current_page', 'next_page', 'prev_page'))->render()]);
        } catch (Exception $e) {
            echo 'Exception when calling SMSApi->smsHistoryGet: ', $e->getMessage(), PHP_EOL;
        }
    }

This is my view files

<table id="sms-table" class="table table-hover datatable-User">
    <thead>
    <th>Date</th>
    <th>From</th>
    <th>Message</th>
    <th>Status</th>
    </thead>
    <tbody>
    @foreach($allMessages as $item)
        @if($item->status == "Received")
            <tr>
                @php $date = \Carbon\Carbon::createFromTimestamp($item->date ) @endphp
                <td>{{$date->toDayDateTimeString()}}</td>
                <td>{{$item->from}}</td>
                <td>{{$item->body}}</td>
                <td><span class="badge badge-success">{{$item->status}}</span> </td>
            </tr>
        @endif
    @endforeach
    </tbody>
</table>
<div class="mt-5">
    <nav aria-label="Page navigation example">
        <ul class="pagination justify-content-center">
            <li class="page-item {{$prev_page == null ? 'disabled' : ''}}" data-page="{{$prev_page == null ? null : $prev_page }}">
                <a class="page-link" {{$prev_page == null ? 'disabled' : ''}} href="" tabindex="-1">Previous</a>
            </li>
{{--            <li class="page-item"><a class="page-link" >1</a></li>--}}
{{--            <li class="page-item"><a class="page-link">2</a></li>--}}
{{--            <li class="page-item"><a class="page-link">3</a></li>--}}
            <li class="page-item" data-page="{{$next_page == null ? null : $next_page }}">
                <a class="page-link" href="#">Next</a>
            </li>
        </ul>
    </nav>
</div>
<script>
    $('.page-item').on('click', function () {
        var page = $(this).data('page')
        $.ajax({
            url: 'https://mydomain.com/api/all-inbound?page=' + page,
            type: 'GET',
            success: function (data) {
                $('#sms-data').html(data.data);
            },

        });
    })
</script>

Nov
02
3 weeks ago
Activity icon

Replied to "syntax Error, Unexpected 'domain' (T_STRING), Expecting ',' Or ')' Error

Send us your error. We will help you on it.

Oct
24
1 month ago
Activity icon

Replied to Update Quantity In Darryldecode/laravelshoppingcart

Thanks. The working solution is this.

public function update(Request $request, $id)
    {
        \Cart::update($id, array('quantity' => array(
            'relative' => false,
            'value' => $request->quantity
        ), ));
        return back()->with('success', 'Item quantity updated in your cart');
    }

Activity icon

Replied to Update Quantity In Darryldecode/laravelshoppingcart

Dear, I am not using "https://github.com/hardevine/LaravelShoppingcart " package. I am uisng "https://github.com/darryldecode/laravelshoppingcart". It update method working as like in my question. Please understand my question.

Activity icon

Replied to Update Quantity In Darryldecode/laravelshoppingcart

I want to do update on a quantity from the cart. Not Item adding.

Activity icon

Replied to Update Quantity In Darryldecode/laravelshoppingcart

Which screenshot you want. This package has that type of thing. https://github.com/hardevine/LaravelShoppingcart . I cannot use it because it does not have conditions to that cart like add coupon or shipping cost.

Activity icon

Replied to Update Quantity In Darryldecode/laravelshoppingcart

This demo does not have an update example like what I am trying to do.

Activity icon

Started a new Conversation Update Quantity In Darryldecode/laravelshoppingcart

Can anyone tell me how to update the quantity in the https://github.com/darryldecode/laravelshoppingcart package? Because When I update the quantity, It's It adds to the current quantity. As an example, if I want to add a 1 quantity to the current item quantity. If my current item qty has 1 qty and this new value of 2, it should be 2 knows. But in this package, it adds to the current value. That's means, after the update it, its values become 3. Can anyone help me to do this

This is my update method :

 public function update(Request $request, $id)
    {
        \Cart::update($id, array('quantity' => $request->quantity,));
        return back()->with('success', 'Item quantity updated in your cart');
    }

Activity icon

Replied to What Is The Best Package For Shopping Cart?

Can anyone tell me how to update the quantity in the https://github.com/darryldecode/laravelshoppingcart package? Because When I update the quantity, It's It adds to the current quantity. As an example, if I want to add a 1 quantity to the current item quantity. If my current item qty has 1 qty and this new value of 2, it should be 2 knows. But in this package, it adds to the current value. That's means, after the update it, its values become 3. Can anyone help me to do this

Oct
23
1 month ago
Activity icon

Replied to What Is The Best Package For Shopping Cart?

@bestmomo Can you teach me how to handle Add to cart button with this package? Need to increment with the click into cart icon in the menu bar? I don't have an idea. Can you teach me?

Oct
18
1 month ago
Activity icon

Replied to Cannot Get Sum Of The Total Working Hours.

Yes. I got that. well explained, Thanks, @rodrigo.pedra

Activity icon

Replied to Cannot Get Sum Of The Total Working Hours.

@rodrigo.pedra Thanks. It's work perfectly.

Activity icon

Replied to Cannot Get Sum Of The Total Working Hours.

@rodrigo.pedra, It's work. Thank you very much for your support. Also, can I know if some calculation has 1:05 it should be shown as 1:25? It means it round off the nearest 25 minutes. Can you help me to do that?

Activity icon

Replied to Cannot Get Sum Of The Total Working Hours.

Nop. Working hours 8:00 AM to 9:00 PM

Activity icon

Replied to Cannot Get Sum Of The Total Working Hours.

No. This is the shift base attendance report. One user can maximum work 5 hours per day.

Activity icon

Started a new Conversation Cannot Get Sum Of The Total Working Hours.

Hi Guys,

I am trying to get sum of total working hours for the user.

My code like below

@php
                                     $total_hours = array();
                                    @endphp
                                    @foreach($reports as $report)
                                        <tr>
                                            <td>{{$report->date}}</td>
                                            <td>{{$report->check_in_time}}</td>
                                            <td>{{$report->check_out_time}}</td>
                                            <td>
                                                @php
                                                    $dteStart = new DateTime($report->check_in_time);
                                                    $dteEnd   = new DateTime($report->check_out_time);
                                                    $dteDiff  = $dteStart->diff($dteEnd);
                                                @endphp
                                                {{ round($dteDiff->format("%H:%I"), 2) }}
                                            </td>
                                            <td> {{ $dteDiff->format("%H:%I") }}</td>
                                        </tr>
                                        @php
                                            $dt = $dteDiff->format("%H:%I");
                                            $total_hours[] = $dteDiff->format("%H:%I");
                                        @endphp
                                    @endforeach

And show sum of the working hours.

<p>{{ array_sum($total_hours)}}</p>

This total coming from

23:00 + 01:05 

Total should be 24:05, But my showing value is rounded value "24". can I know how to show the actual value of "24:05"?

Activity icon

Replied to What Is The Best Package For Shopping Cart?

I will check this. If I need any clarification, can help me on this?

Oct
15
1 month ago
Activity icon

Started a new Conversation What Is The Best Package For Shopping Cart?

Hello everyone, Can I know which package is best for building a shopping cart in laravel?

Oct
13
1 month ago
Activity icon

Awarded Best Reply on How To Calculate Duration From Check In Time & Check Out Time?

@snapey Now I am getting "Data missing" error.

My model like below.

<?php

namespace App;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Attendance extends Model
{
    protected $fillable = ['user_id', 'date', 'check_in_time', 'check_out_time', 'total_hours'];

    protected $casts = [
        'check_out_time' => 'datetime',
        'check_in_time' => 'datetime',
    ];

    public function user()
    {
        return $this->belongsTo('App\User', 'user_id');
    }

    public function getDurationAttribute()
    {
        $in = Carbon::createFromFormat('H:i:s',$this->check_in_time);
	$out =  Carbon::createFromFormat('H:i:s',$this->check_out_time);

	return $in->diffAsCarbonInterval($out)->hours;
}

}

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

Thanks. It's work. I learn new things from you. Thank you very much. @snapey

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

@snapey Now I am getting "Data missing" error.

My model like below.

<?php

namespace App;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Attendance extends Model
{
    protected $fillable = ['user_id', 'date', 'check_in_time', 'check_out_time', 'total_hours'];

    protected $casts = [
        'check_out_time' => 'datetime',
        'check_in_time' => 'datetime',
    ];

    public function user()
    {
        return $this->belongsTo('App\User', 'user_id');
    }

    public function getDurationAttribute()
    {
        $in = Carbon::createFromFormat('H:i:s',$this->check_in_time);
	$out =  Carbon::createFromFormat('H:i:s',$this->check_out_time);

	return $in->diffAsCarbonInterval($out)->hours;
}

}

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

It must have 24 hours format? I store is like

      $data->check_out_time = Carbon::now()->format('H:s:i');

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

@snapey This "check_in_time" & "check_out_time" is time. It's does not have date.

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

I added this to my model. But I was got below error.

Unexpected data found. Unexpected data found. Data missing

@snapey any idea?

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

@snapey I was getting below error

Call to a member function diffAsCarbonInterval() on string

Activity icon

Replied to How To Calculate Duration From Check In Time & Check Out Time?

No Need float number. Enough if I can show to hours in whole numbers.