smartnathan

smartnathan

Member Since 1 Year Ago

Experience Points 1,810
Experience Level 1

3,190 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 5
Lessons
Completed
Best Reply Awards 1
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.

17 Mar
4 months ago

smartnathan started a new conversation Securing Videos Lesson

Please, I am developing a small web application using Laravel just like Laracast Lessons. I want to be able to secure the lessons from download. Also, which media player and vidoe storage provider is best for that. I was thinking of Vimeo. Thanks for your help.

21 Feb
4 months ago

smartnathan started a new conversation Securing Video From Being Downloaded

Good day all, Please am developing a learning platforms where videos will be uploaded and viewed directly from the web application after subscribing. I want to be able to prevent users from downloading the video. Just like what Udemy web application does. I really do appreciate your response. Thank you.

30 Jan
5 months ago

smartnathan left a reply on Accessing Object Property Fails

@vilfago Thank you. I've actually fixed the eager loading you mentioned. But that wasn't the problem though. I relaxed that I had record inconsistencies in the tables. That's what happens when working when you are really stressed out. Thanks all the same. I fixed it.

smartnathan left a reply on Accessing Object Property Fails

This is how i fetched it$purchaseorderheaders = PurchaseOrderHeader::latest()->paginate($perPage);

##This is my PurchaaseOrderHeader Model

 public function purchaseOrderLine()
    {
        return $this->hasOne(PurchaseOrderLine::class, 'purchase_order_header_id');
    }

smartnathan started a new conversation Accessing Object Property Fails

Please, when I try to as this object like this {{ $item->purchaseOrderLine->quantity }}

{"id":7,"purchase_order_header_id":9,"product_id":2,"unit_price":"4343.00","quantity":344,"created_at":"2019-01-29 20:58:26","updated_at":"2019-01-29 20:58:26"}

I get this error

Trying to get property 'quantity' of non-object (View: /var/www/html/inventory-system/resources/views/admin/purchase-order-headers/index.blade.php)

But when I access like this {{ $item->purchaseOrderLine['quantity'] }} it works. Please, what is the problem because I have a product method will want to access to get the associated products.

15 Jan
6 months ago

smartnathan started a new conversation Making A Reporting Page

Please I want to create report page for two different tables. I want to be able to make a query for daily, weekly, monthly and yearly report. Please, is there any way to get this done with Laravel Eloquent.

18 Dec
7 months ago

smartnathan left a reply on Building A Chess Game

@lostdreamer_nl thanks very much. I do appreciate.

smartnathan started a new conversation Building A Chess Game

Good morning all, I want to built a chess game using Laravel. Please, anyone with an idea on how to begin. Are there available libraries to leverage on? Please, I need your help.

03 Dec
7 months ago

smartnathan left a reply on Making A Simple Quiz Application

Please, I need your help.

smartnathan left a reply on Making A Simple Quiz Application

I am actually trying to create a view where a admin can add multiple choice questions and select the corresponding answers.

smartnathan left a reply on How To Pass Array To Where Method And Get The Result.

I don't really know what you want to achieve, but I guess the right was is as thus:

image::where([ 'width' => '1280'])->where(['height' => '768'])->get();

smartnathan started a new conversation Making A Simple Quiz Application

Good morning, I am created a simple quiz application where a user can add multiple choice questions and Select the right answer. I want to be able to get the correct answer and the associated option value. Please, how do I go about this. Or what is the best way to get this done. Thank you, I do appreciate.

View code

<div class="row">
        <div class="col-sm-12">
            <div class="input-group fg-float">
                <span class="input-group-addon"><i class="zmdi zmdi-pin-help

"></i></span>
                <div class="fg-line">
                    <input name="question" type="text" class="form-control">
                    <label class="fg-label">Question</label>
                </div>
            </div>
        </div>

    </div>
<br /><br />
    <div class="row">
                                <div class="col-sm-6">
                                    <div class="input-group fg-float">
                                        <span class="input-group-addon"><i class="zmdi zmdi-check-circle"></i></span>
                                        <div class="fg-line">
                                            <input name="name[]" type="text" class="form-control">
                                            <label class="fg-label">Optiion</label>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-6">

                                            <div class="radio m-b-15">
                                <label>
                                    <input name="answer[]" type="radio" value="1">

                                    <i class="input-helper"></i>
                                    Option one is this and that-be sure to include why it's great
                                </label>
                                    </div>
                                </div>
                            </div>



<br /><br />
    <div class="row">
                                <div class="col-sm-6">
                                    <div class="input-group fg-float">
                                        <span class="input-group-addon"><i class="zmdi zmdi-check-circle"></i></span>
                                        <div class="fg-line">
                                            <input name="name[]" type="text" class="form-control">
                                            <label class="fg-label">Optiion</label>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-6">

                                            <div class="radio m-b-15">
                                <label>
                                    <input name="answer[]" type="radio" value="1">
                                    <i class="input-helper"></i>
                                    Option one is this and that-be sure to include why it's great
                                </label>
                                    </div>
                                </div>
                            </div>



<br /><br />
    <div class="row">
                                <div class="col-sm-6">
                                    <div class="input-group fg-float">
                                        <span class="input-group-addon"><i class="zmdi zmdi-check-circle"></i></span>
                                        <div class="fg-line">
                                            <input name="name[]" type="text" class="form-control">
                                            <label class="fg-label">Optiion</label>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-6">

                                            <div class="radio m-b-15">
                                <label>
                                    <input name="answer[]" type="radio" value="1">
                                    <i class="input-helper"></i>
                                    Option one is this and that-be sure to include why it's great
                                </label>
                                    </div>
                                </div>
                            </div>



<br /><br />
    <div class="row">
                                <div class="col-sm-6">
                                    <div class="input-group fg-float">
                                        <span class="input-group-addon"><i class="zmdi zmdi-check-circle"></i></span>
                                        <div class="fg-line">
                                            <input name="name[]" type="text" class="form-control">

                                            <label class="fg-label">Optiion</label>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-6">

                                            <div class="radio m-b-15">
                                <label>
                                    <input name="answer[]" type="radio" value="1">
                                    <i class="input-helper"></i>
                                    Option one is this and that-be sure to include why it's great
                                </label>
                                    </div>
                                </div>
                            </div>

<button type="submit" class="btn btn-primary">Add Question</button>

Migration file for Quiz Options

Schema::create('quiz_options', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->softDeletes();
            $table->integer('quiz_question_id')->nullable();
            $table->string('name')->nullable();
            $table->boolean('is_answer')->nullable();
            $table->string('answer')->nullable();
            });

Migration file for Quiz Questions

 Schema::create('quiz_questions', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
            $table->softDeletes();
            $table->integer('quiz_type_id')->nullable();
            $table->string('question')->nullable();
            $table->boolean('is_active')->nullable();
            });
25 Oct
8 months ago

smartnathan left a reply on Image Not Uploading In AJAX Request.

###Here is the working Ajax code for image upload using formData API

You will need a SweetAlert library for a lovely alert box

$('#note-form').on('submit', function(e) {
    e.preventDefault();

    let noteFormData = new FormData(this);
noteFormData.append('image', document.getElementById('image').files[0]);
    swal({
        title: 'Are you Sure?',
        text: 'Please! Confirm that you are ready to publish note.',
        type: 'info',
        showCancelButton: true,
        closeOnConfirm: false,
        showLoaderOnConfirm: true,
    }, function(){
        setTimeout(function(){

$.ajax({
        url: "{{ url('/admin/notes')}}",
        type: "POST",
        data: noteFormData,
        contentType: false,
        processData: false,
        cache: false,
        success: function(data) {
             if (data) {
                 swal("Completed!", data.message, 'success');
                $('#note-form')[0].reset();
                } else {
                   swal("Failed!", 'Comment was unable to be submitted, try again', 'error');
                }
        },
        error: function(data) {
            if (data.status === 422) {
                errors = '<div class="alert alert-danger">';
                $.each(data.responseJSON.errors, function(key, value) {
errors += '<li>'+value+'</li>';
                })
              errors +=  '</li></div>';
                $('#errors').html(errors);

            }

        }

    });

        }, 2000);
    });

});
24 Oct
8 months ago

smartnathan left a reply on Image Not Uploading In AJAX Request.

OK, I will do that.

smartnathan left a reply on Image Not Uploading In AJAX Request.

@tykus thanks a lot too. I really do appreciate.

smartnathan left a reply on Image Not Uploading In AJAX Request.

@Cronix Thanks million, it works.

smartnathan left a reply on Image Not Uploading In AJAX Request.

@tykus I'm still getting an Uncaught TypeError: Illegal invocation.

smartnathan left a reply on How Do I Request File Input And Save It In The Databse?

The solution above will store the file in your database look through the code, where you created an instants of your User model.

smartnathan left a reply on Problem With Migration

Create a new database in your xampp server. Ensure the default root user has no password on it. Make database changes in your environment file and run the migration again.

smartnathan left a reply on How Do I Request File Input And Save It In The Databse?

I should solve your problem

if ($request->file('file') != null) {
        $file = $request->file('file');
        $new_file = time() . "." . $file->getClientOriginalExtension();
          $file->move(
        base_path() . '/public/uploads', $new_file
    );
}

          $user = new User([
           'first_name' => $request->input('first_name'),
           'last_name' => $request->input('last_name'),
           'file' => $new_file,
       ]);
       $user->save();

smartnathan started a new conversation Image Not Uploading In AJAX Request.

Good afternoon, please i have an issue uploading an image when I make an Ajax request. But using a default server action of uploading the image it works perfectly well. Please, is there anything i have not done well in the ajax code. Thanks for your help.

View Code

{!! Form::open(['url' => '/admin/notes', 'id' => 'note-form', 'class' => 'form-horizontal', 'files' => true]) !!}

<input autofocus type="text" name="title" class="form-control" placeholder="Write note title..." {{old('title')}} />

  <select id="group" name="class[]" class="chosen" multiple data-placeholder="Choose a class or many classes">
        <option value=""></option>
        @if (isset($user_classes))
        @foreach ($user_classes as $class)
        <option value="{{$class->pivot->group_id}}">{{ $class->name }}</option>
        @endforeach
        @endif
</select>

<input type="file" name="image" id="image">

{!! Form::close() !!}

Controller Code

$requestData = $request->except('image');
        if ($request->file('image') != null) {
        $image = $request->file('image');
        $new_image = time() . "." . $image->getClientOriginalExtension();
 
          $image->move(
        base_path() . '/public/uploads', $new_image
    );
        }

        foreach ($requestData['class'] as $group) {
            $new_note = new Note;
        $new_note['user_id'] = Auth::user()->id;
        $new_note['group_id'] = $group;
        if (isset($requestData['title'])) {
        $new_note['title'] = $requestData['title'];
        }
         if (isset($new_image)) {
      $new_note['image'] = $new_image;
          }
        $new_note['body'] = $requestData['body'];
        $new_note['visibility'] = 1;
        $new_note->save();
        }

        if ($request->ajax()) {
            return response()->json(['message' => 'Note was successfully submitted!']);
        } else {
            return redirect('admin')->with('flash_message', 'Your note was successfully added to your class.');
        }

Ajax Code


$('#submit-note').on('click', function(event) {
    event.preventDefault();
$.ajax({
        url: "{{ url('/admin/notes')}}",
        type: "POST",
        dataType: "JSON",
        data: $("#note-form").serialize();,
        success: function(data) {
             if (data) {
                //console.log(data);
                 swal("Completed!", data.message, 'success');
                $('#note-form').trigger('reset');
                } else {
                   swal("Failed!", 'Comment was unable to be submitted, try again', 'error');
                }
        },
        error: function(data) {
            if (data.status === 422) {
                errors = '<div class="alert alert-danger">';
                $.each(data.responseJSON.errors, function(key, value) {
errors += '<li>'+value+'</li>';
                })
              errors +=  '</li></div>';
                $('#errors').html(errors);

            }

        }

    });

    });

28 Aug
10 months ago

smartnathan started a new conversation Implementing Permission On Methods In Controller Classes

Please, am using appzcoder crud generator. I'm trying to implement permission check as a middleware. Please, how do I tie this permissions to my methods in the controller classes. I need your assistance, I do appreciate.

12 Aug
11 months ago

smartnathan left a reply on Problem With Vhosts

<VirtualHost *:80> ##ServerAdmin [email protected] DocumentRoot "C:/xampp/htdocs/test/public" ServerName app.test ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common

smartnathan left a reply on Problem With Vhosts

You didn't remove the comments there. Hence, the reason you are having that issue.

smartnathan left a reply on Hotel Rooms Booking System.

Please, what if a guest wants to book a room a week ahead. Please, what is the best way to ensure that the rooms are still available on the list. Where the Room model manages all rooms and the Booking model manages all rooms being booked. I'm really concern about the query using eloquent or query builder.

smartnathan left a reply on Hotel Rooms Booking System.

@larafam, @ondes and @Krisell I don't know how to thank you all. I really do appreciate for all your concerns and assistance. May the Good Lord Bless you abundantly. Thanks once again.

smartnathan started a new conversation Hotel Rooms Booking System.

Please, am building a hotel management system. I have two models Rooms and Booking. Rooms will list all this rooms in the hotel. But I want to be able to list only rooms that hasn't been booked. Please, how do I solve this with Eloquent or query builder.

01 Aug
11 months ago

smartnathan left a reply on Fingerprint Capture And Verification

I am looking at a situation whereby while the medical record officer is creating an account for a new patient. He enters the bio-data and all of that as well as capturing the patient's fingerprint. So, there will be a fingerprint scanner attached to the officer's laptop. So, my challenge here is being able to integrate it with Laravel. Such that on the registration form there will be an area for fingerprint capture. The. Integration is my major challenge. I do appreciate all your help. Thank you.

31 Jul
11 months ago

smartnathan left a reply on Fingerprint Capture And Verification

Actually, the fingerprint will be used to quickly pull the patients' details without necessarily using any patient unique number. Also, for emergency in case the patient is not able to speak for some reasons.

smartnathan started a new conversation Fingerprint Capture And Verification

I am building a hospital management system with Laravel, on my users table I have a field for fingerprint. I want to be able to get the users fingerprint as part of the registration process when they come to the hospital for the very first time. Please, how do I go about implementing the fingerprint part on the registration form?

01 Mar
1 year ago

smartnathan started a new conversation MAC Addresses On LAN

Is there any Laravel Request Helper function that I can use to get the MAC address of Nodes on a LAN?

27 Feb
1 year ago

smartnathan left a reply on Is There A Way To Get User's MAC Address

So, how do I get the client's MAC address if the Server and the Client are on the same LAN?