modiz

modiz

Member Since 1 Year Ago

Experience Points 380
Experience Level 1

4,620 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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

06 Nov
7 months ago

modiz started a new conversation Datetime Picker Linked Validation

I have 2 DateTime Pickers on my page, a Start and End. If the start date/time is selected, then for the End picker, all the dates before the Start date/time should be disabled.

I am using this date/time picker: https://xdsoft.net/jqplugins/datetimepicker/

Problem: Using their example for the date range works for me, but it does not validate/disable the time when certain date/time is selected.It only disables the date, and for the time, if a start time is selected, then for the end time it will disable all the times before the CURRENT TIME, not the selected start time.

//View File

@extends('layouts.staff')
@section('styles')
<link  href="{{ asset('/bootstrap-3.3.7-dist/css/jquery.bootstrap.min.css') }}" rel="stylesheet"  >
<link  href="{{ asset('/dtpicker/jquery.datetimepicker.min.css') }}" rel="stylesheet"  >
@endsection
@section('content')

<body>
    <div class="container">
        <div class="row">

          <div class="column">
                            
                            <div class="panel-body">
                                <label>Set Date and Time</label>
                                <div style="position: relative; left: 15px;">
                                    <div class="form-group">
                                        <p>
                                            Start:
                                        </p>
                                        <div class="row">
                                            <div class='col-md-8 col-md'>

                                                <div class='input-group date'>
                                                     <span class="input-group-addon">
                                                        <span class="glyphicon glyphicon-calendar"></span>
                                                    </span><input id="date_timepicker_start" type="text" value="">
                                                    
                                                </div>

                                            </div>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <p>
                                            End:
                                        </p>
                                        <div class="row">
                                            <div class='col-md-8 col-md'>

                                                <div class='input-group date'>
                                                     <span class="input-group-addon">
                                                        <span class="glyphicon glyphicon-calendar"></span>
                                                    </span>
                                                    <input id="date_timepicker_end" type="text" value="">
                                                    
                                                </div>

                                            </div>

                                        </div>

                                    </div>
                                </div>
                            </div>
                        </div>      
         

        </div>

    
    </div>

    @section('javascripts')


    <script type="text/javascript" src="/dtpicker/jquery.datetimepicker.full.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#date_timepicker_start').datetimepicker({
                step: 5,
                dayOfWeekStart: 1,
                format:'Y-m-d H:i',
                   onShow:function(ct){
                    this.setOptions({
                     maxDate:jQuery('#date_timepicker_end').val()?jQuery('#date_timepicker_end').val():false,
                     maxTime:jQuery('#date_timepicker_end').val()?jQuery('#date_timepicker_end').val():false,
                     formatDate: 'Y-m-d H:i'
                    });
                   }

               });
            $('#date_timepicker_end').datetimepicker({
                step: 5,
                dayOfWeekStart: 1,
                format:'Y-m-d H:i',
                   onShow:function(ct){
                    this.setOptions({
                     minDate:jQuery('#date_timepicker_start').val()?jQuery('#date_timepicker_start').val():false,
                     minTime:jQuery('#date_timepicker_start').val()?jQuery('#date_timepicker_start').val():false,
                     formatDate: 'Y-m-d H:i'
                    });
                   }
               });
        });
    </script>
    @endsection
</body>
@endsection

How do I validate both the date and time? Is there another way to validate right after user selects start and end date?

19 Oct
7 months ago

modiz left a reply on DateTime Picker

@Snapey Yes //layouts.staff

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'CAD') }}</title>

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    @yield('styles')
</head>
<body>
    <style>
        div.maxHeight {
            max-height: 907.38px;
            overflow: auto;
        }

        content {
            max-height: 50px;
            overflow: auto;
        }

        footer {
            position: fixed;
            background-color: #000000;
            color: white;
            padding: 20px;
            bottom: 0;
            width: 100%;
        }
    </style>
        
        
    <div>
        @include('layouts.navbar')

        @yield('content')
    </div>
    
         <footer>
             <div class="container-fluid">
                    <p class="text-center">© 2018 Test</p>
             </div>
         </footer>
    



    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}"></script>
    <script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
    @yield('javascripts')
</body>
</html>

modiz left a reply on DateTime Picker

@Snapey Yes I have been, there are no errors

modiz left a reply on DateTime Picker

Thanks, @Cronix I had the jquery in my layout.staff file. However, I added it to java script section but the textbox still doesn't expand to the calendar.

@section('javascripts')
    <script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.js"></script>
    <script type="text/javascript" src="/js/moment.js"></script>
    <script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js"></script>
   
@endsection

modiz started a new conversation DateTime Picker

The problem I am having with the Datetime picker is that the calendar will not show/dropdown. All I have is the text box and when you click on it, it wont expand. Also when I add the Datetime picker plugin to a page, my Navbar looks distorted and the dropdown menu in my Nav bar stops working only on that page.

I have also added all the necessary scripts need for the plugin to work

@extends('layouts.staff')
@section('styles')
<link href="{{ asset('/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ asset('/css/bootstrap-datetimepicker.min.css') }}" rel="stylesheet" type="text/css">
 @endsection
@section('content')
<style>
    .column {
        float: left;
        width: 50%;
        padding: 10px; /* Should be removed. Only for demonstration */
    }
</style>

<body style="background-color: #ffffff;">
    <div class="container">
        <div class="row">
            
                
                    <form class="form-horizontal" method="POST" enctype="multipart/form-data">
                        <input type="hidden" name="_token" value="{!! csrf_token() !!}">
                        
                        <div class="panel-body">

                            <h2>Schedule Session</h2>

                            <hr>

                            <label><i>All fields marked with an asterisk<font color="red"><b>*</b></font> are required.</i></label>
                            
                            @if($errors->any())
                            <div class="alert alert-danger">
                                <p><strong>The following is required:</strong></p>
                                <ul>
                                    @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                            @endif

                            @if (session('status'))
                                <div class="alert alert-success">
                                 {{ session('status') }}
                                </div>
                            @endif

                            <div class="row">
                                <div class="column">
                                    
                                        <!-- CHOOSE SESSION NAME -->
                                        <div class="panel-body">
                                            <label for="file"><font color="red"><b>*</b></font>Session Name:</label><br>
                                            <div class="col-md-8 col-md">
                                              <input type="text" class="form-control" id="title" placeholder="Lab1-Core2" name="title" value="{{ old('title') }}">
                                            </div>
                                        </div>

                                      
                                        <!-- MARKING METRICS -->
                                        <div class="panel-body">
                                            <label><font color="red"><b>*</b></font>Select Location:</label><br>
                                            <div class="col-md-8 col-md">
                                                <select class="form-control" name="title">
                                                    <option>ETB 118</option>
                                                    <option>ETB 101</option>
                                                    <option>ITB 101</option>
                                                </select>
                                            </div>
                                        </div>
                                </div>

                                <div class="column">
                                    <!-- SET TOLERANCE -->
                                    <div class="panel-body">
                                        <label><font color="red"><b>*</b></font>Set Date and Time</label>
                                        <div style="position: relative; left: 15px;">
                                            <div class="form-group">
                                                <p>
                                                    From:
                                                </p>
                                                 <div class="row">
                                                    <div class='col-md-8 col-md'>
                                                        
                                                            <div class='input-group date' id='datetimepicker1'>
                                                                <input type='text' class="form-control" />
                                                                <span class="input-group-addon">
                                                                    <span class="glyphicon glyphicon-calendar"></span>
                                                                </span>
                                                            </div>
                                                        
                                                    </div>
                                                    <script type="text/javascript"> 
                                               $(document).ready(function(){
                                                $('#datetimepicker1').datetimepicker({
                                                  language: 'pt-en'
                                                });
                                              });
                                            </script>
                                                </div>
                                                 </div>

                                            <div class="form-group">
                                                <p>
                                                    To:
                                                </p>
                                                
                                                <div class="row">
                                                    <div class='col-md-8 col-md'>
                                                        
                                                            <div class='input-group date' id='datetimepicker1'>
                                                                <input type='text' class="form-control" />
                                                                <span class="input-group-addon">
                                                                    <span class="glyphicon glyphicon-calendar"></span>
                                                                </span>
                                                            </div>
                                                        
                                                    </div>
                                                    <script type="text/javascript"> 
                                               $(document).ready(function(){
                                                $('#datetimepicker1').datetimepicker({
                                                  language: 'pt-en'
                                                });
                                              });
                                            </script>
                                                </div>
                                                
                                                </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <hr>
                            
                            <div class="row">
                                <div class="panel-body">
                                    <a href="{{ URL::previous() }}" class="btn btn-default">Cancel</a>
                                    <button type="submit" class="btn btn-primary">Submit</button>
                                </div>
                            </div>
                        </div>
                    </form>
            
        </div>
    </div>
    @section('javascripts')
<script type="text/javascript" src="/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/js/moment.js"></script>
<script type="text/javascript" src="/js/bootstrap.js"></script>
 
@endsection
</body>
@endsection
27 Aug
9 months ago

modiz left a reply on Accessing A Page If You're Within A Specific IP Address Range?

This is something that works, but this is not the correct way to do this and method is wrong. I dont want to strip the '.' out of the ip address. I want to filter the ip address and check the first 3 octets because that is the correct way to check for range.

 $ip= $request->ip();
        $STRip = str_replace(array('.', ','), '' , $ip);
        $NUMip = (int)$STRip;
        $HighIP = "10011170255";
        $LowIP =  "10011170000"; //IP Address change to a different one
         if($NUMip <= $HighIP && $LowIP <= $NUMip){
           
           return response(view('private')); 
         
         }

         else{
        
            
            return response(view('public')); 
         }

modiz started a new conversation Accessing A Page If You're Within A Specific IP Address Range?

I am trying to allow access to a page when someone is within a specific IP range. I am able to do this with a specific ip address but not within a range.

IP middleware

public function handle($request, Closure $next)
    {
        if ($request->ip() != "XXX.XXX.XXX.204"){
            abort(404);
        }
        return $next($request);

How do I check if the IP is within a range of Ip?

I want to do something that will filter out the first 3 octets of the ip from the whole IP and check to see if the first 3 octets of the remote IP matches the 3 octets of the IP in the code. Does this makes sense?

For example: Check if the ip has 100.111.23.* -the first 3 octets have to be the same, the * can be any number between 0-255

I dont know how to filter of the first 3 octets of the ip, or check the range in general. Can someone help?

Thanks in advance.

12 Jun
1 year ago

modiz left a reply on Form Request Validation

ok, thank you everyone( @rin4ik @martinbean @tykus) for clearing this up for me.

modiz started a new conversation Form Request Validation

Is there a way to call the form request validation inside the controller function?

For example currently I have: Controller

    {
        $category = new Category(array(
                    'name' => $request->get('name'),
                ));
                
             $category->save();
             return redirect('/categories/create')->with('status', 'A new category has been created!');
    }```

CategoryFormRequest
```public function rules()
    {
        return [
            'name' => 'required|min:3',
                        
        ];
    }```

with this the incoming form request is validated before the controller method is called. but i want it to go to controller function  first and then validate. How would I go about doing this?
08 Jun
1 year ago

modiz left a reply on Retaining Selected Values From Dropdown When Validator Fails (Many-To-Many)

Thank You @Cronix for the help, I'm learning how to code. :)

modiz left a reply on Retaining Selected Values From Dropdown When Validator Fails (Many-To-Many)

@Cronix so something like this? @if(in_array($category->id, $test )) selected="selected" @endif

modiz started a new conversation Retaining Selected Values From Dropdown When Validator Fails (Many-To-Many)

I have tried @if (old('categories')== $category->id) select="selected" @endif but it doesnt work.

View

<label for="categories" class="col-lg-2 control-label">Categories </label>
<div class="col-lg-10">
<select class="js-example-basic-multiple form-control" id="category" name="categories[]" multiple >
@foreach($categories as $category)
<option value="{!! $category->id !!}">
{!! $category->name !!}
@endforeach
</option>
</select>
    <span class="help-block">Choose atleast 1 category</span>
</div>
</div>

TicketsController

    {
        
                 $slug = uniqid();
                $ticket = new Ticket(array(
                    'title' => $request->get('title'),
                    'content' => $request->get('content'),
                    'slug' => $slug
                ));
                $ticket->save();
               
                 $ticket->categories()->sync($request->get('categories'));

               }```

modiz started a new conversation Testing

Learning