Nikki

Nikki

Member Since 1 Year Ago

Experience Points
3,720
Total
Experience

1,280 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
3,720 XP
Oct
31
2 weeks ago
Activity icon

Replied to Parse Error: Syntax Error, Unexpected '?'

@nakov - I got it working. For some reason my localhost didn't change the php version to 7.2 when I had changed and restarted it.

Thanks for helping. The links were a great help

Activity icon

Replied to Parse Error: Syntax Error, Unexpected '?'

The whole application isn't running. It was working fine 2 days ago and I haven't touched it at all

Activity icon

Started a new Conversation Parse Error: Syntax Error, Unexpected '?'

I'm getting this error

 Parse error: syntax error, unexpected '?' in E:\My-computer\Wamp\www\laravel-site\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 243

I don't know why I'm getting this error. I haven't touched anything in the vendor folder

Jul
25
3 months ago
Activity icon

Started a new Conversation Getting The Word Price To Show Up On Every Page In Laravel Snappy Pdf

I'm trying to create a pdf that on every page it will have price on the right hand side on top of all the prices. The way I've done it is that each product falls under their respective category and it's in a table format. Now because every category has different amounts of product not all categories end up starting on a new page. I'm also using barryvdh/snappy

Here is my product-pdf.blade.php

<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  </head>

  <body style="font-family: arial;">
    <div style="text-align: center; font-size: 40px;">Product Catalogue</div>
    
    <div>
      @foreach($product_categories as $category)
        @if(count($category->parentCategory()->where('category_id', '>', 0)->where('active', '1')->get()) && $category->active == 1)
          <div style="text-align: center; font-size: 40px; padding-top: 20px;">
            {{ $category->title }} !!
          </div>

          <table width="100%">
            <tr>
              <td colspan="2"></td>
              <td>Price</td>
            </tr>
          </table>
      
          @if(count($category->parentCategory))
            @foreach($category->parentCategory as $parent)
              @if(count($parent->parentCategory()->where('category_id', '>', 0)->where('active', 1)->get()) && $parent->active == 1)
                <div style="text-align: center; font-size: 40px; padding-top: 20px;">
                  {{ $parent->title }} @@
                </div>
      
                @if(count($parent->parentCategory))
                  @foreach($parent->parentCategory as $child)
                    @if($child->active == 1)
                      <div style="text-align: center; font-size: 40px; padding-top: 20px;">
                        {{ $child->title }} ##
                      </div>


                      <table width="100%">
                        @foreach($child->product as $product)
                          <tr class="page">
                            <td style="border-bottom: 2px solid #bab6b6;">
                              <?php
                                $image = getImagesArray($product->image);
                              ?>

                              @if(!empty($image))
                                <img src={!! asset("product_images/products/$image[0]") !!} width="100">
                              @endif
                            </td>

                            <td style="border-bottom: 2px solid #bab6b6;">
                              <div>
                                {{ $product->supplier_code }}
                              </div>

                              <div>
                                {{ $product->description }}
                              </div>
                            </td>

                            <td style="border-bottom: 2px solid #bab6b6; text-align: right;">
                              R {{ $product->unit_price }}
                            </td>
                          </tr>
                        @endforeach
                      </table>
                    @endif
                  @endforeach
                @endif
              @elseif($parent->active == 1)
                <div style="text-align: center; font-size: 40px; padding-top: 20px;">
                  {{ $parent->title }} $$
      
                  <table width="100%">
                    @foreach($parent->product as $product)
                      <tr>
                        <td style="border-bottom: 2px solid #bab6b6;">
                          <?php
                            $image = getImagesArray($product->image);
                          ?>

                          @if(!empty($image))
                            <img src={!! asset("product_images/products/$image[0]") !!} width="100">
                          @endif
                        </td>

                        <td style="border-bottom: 2px solid #bab6b6;">
                          <div>
                            {{ $product->supplier_code }}
                          </div>

                          <div>
                            {{ $product->description }}
                          </div>
                        </td>

                        <td style="border-bottom: 2px solid #bab6b6; text-align: right;">
                          R {{ $product->unit_price }}
                        </td>
                      </tr>
                    @endforeach
                  </table>
                </div>
              @endif  
            @endforeach
          @endif
        @elseif($category->active == 1 && $category->category_id == 0)
          <div style="text-align: center; font-size: 40px; padding-top: 20px;">
            {{ $category->title }} %%
          </div>
      
          <table width="100%">
            @foreach($category->product as $product)
              <tr>
                <td style="border-bottom: 2px solid #bab6b6;">
                  <?php
                    $image = getImagesArray($product->image);
                  ?>

                  @if(!empty($image))
                    <img src={!! asset("product_images/products/$image[0]") !!} width="100">
                  @endif
                </td>

                <td style="border-bottom: 2px solid #bab6b6;">
                  <div>
                    {{ $product->supplier_code }}
                  </div>

                  <div>
                    {{ $product->description }}
                  </div>
                </td>

                <td style="border-bottom: 2px solid #bab6b6;">
                  R {{ $product->unit_price }}
                </td>
              </tr>
            @endforeach
          </table>
        @endif
      @endforeach
    </div>
  </body>
</html>

and here is my downloadPdf function

public function downloadPdf()
{
    $products = Product::all();

    $categories = Category::with('product')->where('active', 1)->where('category_id', '>', '1')->get();

    $product_categories = Category::where('category_id', 0)->with('parentCategory')->get();

    $pdf = PDF::loadView('admin.pdf.product-pdf', compact('categories', 'product_categories'));

    return $pdf->download('catalogue.pdf');
}

I did try to have this

$pdf->setOption('header-html', 'http://laravel-pdf.test/admin/pdf/header');

but it never showed up

Jul
19
3 months ago
Activity icon

Replied to The Exit Status Code '1' Says Something Went Wrong

Installing it on to windows worked. Thank you so much

Activity icon

Replied to The Exit Status Code '1' Says Something Went Wrong

Yep I did install wkhtmltopdf into my laravel folder

Activity icon

Started a new Conversation The Exit Status Code '1' Says Something Went Wrong

I'm trying to use barryvdh/laravel-snappy to create and download a pdf. When I press the button to do that I get this error

The exit status code '1' says something went wrong:\n
stderr: "'E:\Nikki\Wamp\www\laravel-site\vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64' is not recognized as an internal or external command,\r\n
operable program or batch file.\r\n
"\n
stdout: ""\n
command: E:\Nikki\Wamp\www\laravel-site\vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 --lowquality "C:\WINDOWS\TEMP\knp_snappy5d31af0e0312a0.05084823.html" "C:\WINDOWS\TEMP\knp_snappy5d31af0e037c33.10174994.pdf".

This is my controller function

public function downloadPdf()
    {

        $pdf = PDF::loadView('admin.pdf.product-pdf');

        return $pdf->download('test.pdf');
    }

and this is the snappy.php in the config folder

return array(


    'pdf' => array(
        'enabled' => true,
        'binary'  => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
        'timeout' => false,
        'options' => array(),
        'env'     => array(),
    ),
    'image' => array(
        'enabled' => true,
        'binary'  => base_path('vendor/h4cc/wkhtmltoimage-amd64/bin/wkhtmltoimage-amd64'),
        'timeout' => false,
        'options' => array(),
        'env'     => array(),
    ),


);

Jul
12
4 months ago
Activity icon

Replied to Not Getting The Same Result In Vue

I will try and fix it, but I still don't get why I'm getting that error on my server and not on my localhost and at the moment that has me stumped

Jul
11
4 months ago
Activity icon

Replied to Not Getting The Same Result In Vue

@munazzil - my localhost is php 7.2 and my server is php 7.1.

@wilk_randall - But wouldn't that show up in my localhost as well?

Activity icon

Started a new Conversation Not Getting The Same Result In Vue

So I uploaded my site I was working on to my server and found out that the section that had the vue selection wasn't working. I don't know why that is happening when on my localhost it works just fine.

This is the error I get on my server site

Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "selected_parent"

but I don't get any errors on my localhost.

Was I supposed to have done something before I uploaded or after?

Jul
09
4 months ago
Activity icon

Replied to Select Drop Down Not Selecting On First Click

I think I got it.

I changed

<select name="supplier_code" id="supplier_code" class="form-control mb-2 mt-10" v-model="selectedValue" required>

back to

<select name="supplier_code" id="supplier_code" class="form-control mb-2 mt-10" v-model="selected_parent" required>

and I did this

<option :value="selectedValue">Please select your code</option>

This seems to be working. Thanks so much for helping @raravel

Activity icon

Replied to Select Drop Down Not Selecting On First Click

That didn't work either

Activity icon

Replied to Select Drop Down Not Selecting On First Click

So this is what it looks like at the moment.

and this is what I would like it to look like

Does that help a bit more?

Activity icon

Replied to Select Drop Down Not Selecting On First Click

I did do that but it's still the same as above

Activity icon

Replied to Select Drop Down Not Selecting On First Click

I'm still not getting the Please select your code to be displayed and I'm not getting any errors.

Here is an image so that you can see what I mean.

Activity icon

Replied to Select Drop Down Not Selecting On First Click

The select box disappeared and I got this error in my console.

TypeError: undefined has no properties
Activity icon

Replied to Select Drop Down Not Selecting On First Click

If I remove that then I get a blank area instead of Please select your code

Activity icon

Started a new Conversation Select Drop Down Not Selecting On First Click

I created a page that uses a vue component and in that component is a drop down select. The issue I'm having is that I have to select the item twice before it gets selected. I'm not sure what I'm missing so that I can fix it.

Here is my vue component

<template>
    <div>
        <form @submit.prevent="submit">
            <div class="row">
                <div class="col-lg-12 supplier_code_select">
                    <select name="supplier_code" id="supplier_code" class="form-control mb-2 mt-10" v-model="selected_parent" required>
                        <option :value="selected_parent">Please select your code</option>
                        <option v-for="product in products" :value="product.id">
                            {{ product.supplier_code }}
                        </option>

                        <option v-for="child in children" :value="child.id">
                            {{ child.supplier_code }}
                        </option>
                    </select>
                </div>
            </div>

            <input type="submit" class="btn btn-dark btn-lg btn-block" value="Add To Cart">
        </form>
    </div>
</template>

<script>
    import axios from 'axios'

    export default {
        props: [
            'products',
            'children',
            'selected_parent'
        ],

        mounted() {
            console.log('Component mounted.')
        },

        methods: {
            submit(){
                var formData = new FormData();

                console.log('this is the select box - '+this.selected_parent);
                formData.append('supplier_code', this.selected_parent);

                return axios.post('/add-to-cart/'+this.selected_parent, formData)
                            .then(
                                function(response)
                                {
                                     console.log(response.data.redirect);
                                     window.location = response.data.redirect;
                                }
                            );
            },
        },
    }
</script>
May
23
5 months ago
Activity icon

Replied to Adding A Zero To A Calculation

Nevermind I just found it now after I had submitted this question.

This is what I did

@if(!empty($parent->price))
    @php
        $percent_price = $parent->price * 0.15;
        $total = $percent_price + $parent->price;
        $price = sprintf("%0.2f", $total);
    @endphp

    <td>
        R{{ $price }}
    </td>
@endif
Activity icon

Started a new Conversation Adding A Zero To A Calculation

This might be a simple and silly question, but I can't seem to get my head around it.

What I would like is that if my calculations needs a 0 at the end then it should put one.

For example I get 20.2 but what I want is 20.20

This is my code

@if(!empty($parent->price))
    @php
        $percent_price = $parent->price * 0.15;
        $price = $percent_price + $parent->price;
    @endphp

    <td>
        R{{ $price }}
    </td>
@endif