jlucia

jlucia

Member Since 3 Years Ago

Experience Points 23,870
Experience Level 5

1,130 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 185
Lessons
Completed
Best Reply Awards 7
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.

13 May
1 month ago

jlucia left a reply on Allow Link In Vue Js Chat

Try changing the message div to v-html.

<div class="text" v-html="message.text"></div>
10 May
1 month ago

jlucia left a reply on Set A Default Value If Input Field Is Blank

Why not just remove the validation on the Referrer and then handle it on the create method?

'Referrer' => is_null($data('Referrer')) ? 1 : $data('Referrer')

jlucia left a reply on Decrease Stock Base On Order Quantity

Can you just subtract the quantity since you know the value?

$stock->decrement('quantity', $data2['quantity']);

jlucia left a reply on Unhandled Promise Rejection: TypeError: Undefined Is Not An Object (evaluating 'response.data')

What is being returned to the addReply() method after you submit?

08 Apr
2 months ago

jlucia left a reply on Class 'GuzzleHttp\Client' Not Found

Are you positive the vendor folder for guzzlehttp is there on the server? Could you be missing guzzlehttp/guzzle in the server's composer.json file?

jlucia left a reply on AutoComplete Using Database Issue With Passing Variable

Did you try this in the template?

{{ result.organizationName }}

jlucia left a reply on Getting A Value From A Cell In A Database

Can you utilize a LIKE %% search for this?

$product = Product::where('supplier_code', 'LIKE', '%'.$supplier_code.'%')->get();

jlucia left a reply on Get Data From Xml Api

Try this procedure to get the XML data and recognize the CDATA.

$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
29 Mar
2 months ago

jlucia left a reply on Retrieve The Data From Table With Half The Value Laravel

I think you have a few options for this but maybe just use appends in the PurchaseList model so you have the original data if needed.

So, in your model file...

    /**
     * The accessors to append to the model's array form.
     *
     * @var array
     */
    protected $appends = [
        'half_quantity', 'half_rate',  
    ];

    /**
     * Get half of the quantity.
     */
    public function getHalfQuantityAttribute()
    {
        return $this->quantity / 2;
    }

    /**
     * Get half of the rate.
     */
    public function getHalfRateAttribute()
    {
        return $this->rate / 2;
    }

Then when you do your foreach loop, call the new variables.

    $purchase_list->half_quantity;
    $purchase_list->half_rate;
06 Feb
4 months ago

jlucia left a reply on Password Reset Error

Have you done a composer update recently?

05 Feb
4 months ago

jlucia left a reply on Vue: Getting Undefined Error

Does it work if you remove the <= in the for loop?

i<state.cartItems.length;

05 Dec
1 year ago

jlucia left a reply on Confirmation Box For A Link

This should be a quick and easy way.

<a role="button" class="btn btn-primary btn-sm" href="#" onclick="return confirm('Are you sure?')">Download Application form</a>

jlucia left a reply on Writing To A File With Start And End

I don't think it would be changed under a single comment. It is just a simple find and replace. It should only add what you want to that one line and leave the text above and below it alone.

jlucia left a reply on Writing To A File With Start And End

Is there any reason you need a start and end comment?

Just replace a single comment with your custom content. Maybe name it #placeholder or whatever you like, it should still just replace what you need.

jlucia left a reply on Fatal Error In MimeTypeGuesser.php For Larger File Uploads? (L 5.4)

Could it be related to your PHP ini file settings? What is your value for post_max_size and upload_max_filesize?

jlucia left a reply on Laravel Eloquent Query Has Issues, While As Raw Query Works Fine

Can you show your Eloquent query also?

01 Dec
1 year ago

jlucia left a reply on Guzzle Queries

What happens if you jsn_decode it?

$content = json_decode($data->getBody());

jlucia left a reply on Simple Mistake? Converting SQL To Eloquent, Inner Join Question

Try this query.

$results = DB::table('groups_plans')
          ->join('plans', 'plans.id','=','groups_plans.plan_id')
          ->where('groups_plans.group_id','=', $group->id)
          ->select('groups_plans.*','plans.*')
          ->get();
20 Nov
1 year ago

jlucia left a reply on Shared State With Components - Vue.js And Laravel 5.5

Try this in your app.js

window.Vue = require('vue');

export let store = {
    username: 'JohnDoe',
};

Vue.component('scan-container', require('./components/ScanContainer.vue'));

const app = new Vue({
    el: '#app',
});
16 Aug
1 year ago

jlucia left a reply on PHP ZipArchive To Zip Files With No Folders.

Any Zip gurus out there?

13 Aug
1 year ago

jlucia started a new conversation PHP ZipArchive To Zip Files With No Folders.

I have 6 csv files inside of /storage/exports. I need to be able to zip up all 6 files into an archive so when unzipped, the 6 files are there, with no parent folder. From what I have tried, when I loop through the 6 files, the ZipArchive creates a folder with the name of the archive, regardless if I tell it to not use any path. If I simply loop through 1 file, it goes into the zip as expected with no other folders. I am thinking this may be a limitation of that class.

Maybe some of you have needed to do this and would have a suggestion. The backup plan is to run a script to do it in linux, but a pure PHP option would be perfect for the app it will be part of.

Here is what I have so far.

$destination = storage_path('exports/');

$archive = $destination.'archive.zip';

// If using just file1.csv, it works, when I loop through all, I get a folder.

$files = [
    'file1.csv', 'file2.csv', 'file3.csv', 'file4.csv', 'file5.csv', 'file6.csv'
];

$zip = new ZipArchive;

if(file_exists($archive)) {
    $zip->open($archive, ZipArchive::OVERWRITE); 
} else {
    $zip->open($archive, ZipArchive::CREATE);
}

foreach($files as $file) {
    $zip->addFile($destination.$file, $file);
}

$zip->close();

echo "Done";

Thanks for any suggestions out there. JL

09 May
2 years ago

jlucia left a reply on Hacked Again :(

Also make sure the public facing folder is not set for 777, or writable by the web server user.

08 May
2 years ago

jlucia left a reply on V-if Inside Of V-for Loop (showing All All Components)

I would suggest using toggle to simple show/hide the edit form.

<template>
    <div>
        <div v-for="(subject, index) in subjects" :key="subject.id" :subject="subject">
            <div v-if="editing">
                <div class="form-group">
                    <input type="text" name="subject" class="form-control" v-model="form.name">
                </div>
                <div class="form-group">
                    <button v-on:click="update()" class="btn btn-xs btn-primary">Update</button>
                    <button v-on:click="toggle()" class="btn btn-xs btn-link">Cancel</button>
                </div>
            </div>
            <div v-else>
                <a href="#">{{ subject.name }}</a> <span class="badge">{{ subject.stacks.length }}</span> 
                <button v-on:click="edit(subject)" class="btn btn-xs">Edit</button>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props: ['subjects'],
        data: function(){
            return {
                editing: false,
                form: {
                    name: ''
                }
            }
        },
        methods: {
            toggle: function () {
                this.editing = !this.editing;
            },
            edit: function (subject) {
                this.form.name = subject.name;
                this.toggle();
            },
            update: function() {
                alert('Presed update!')
                this.toggle()
            }
        }
    }
</script>

jlucia left a reply on Can't Register New Components

I am assuming you ran npm run dev or gulp depending your version to recompile the app.js?

jlucia left a reply on Errno: 150 "Foreign Key Constraint Is Incorrectly Formed"

Check the order of your migrations. If your migrate command is trying to make the post_categories table before the posts table this will occur with MySQL. It seems to go in order of date, oldest to newest.

04 May
2 years ago

jlucia left a reply on Validation Required_if Array Issue

Try removing the ,null so just 'check' => 'required_unless:amount.*.

jlucia left a reply on Validation Required_if Array Issue

Can you try a different approach?

'check' => 'required_unless:amount.*, null',

jlucia left a reply on Changed Data In Component Interrupts Execution Of Code Block.

Could you do something like this?

chooseStarIcon(n) {
    if(this.roundedRating >= n){
        return 'star';
    }
    else if(this.roundedRating <= n && this.roundedRating >= n-1){
        return 'star_half';
    }
        else return 'star_border';
    }
},

jlucia left a reply on Changed Data In Component Interrupts Execution Of Code Block.

What would the rating value look like in this situation?

jlucia left a reply on Changed Data In Component Interrupts Execution Of Code Block.

Is numberOfDegrees an array of data or an object? Would there only be one value associated with it?

29 Apr
2 years ago

jlucia left a reply on Can't Pass Data From Blade To Vue Through A Prop

Try

props: ['dictionary']

jlucia left a reply on Stripe Charge Failing

Glad it's working!

jlucia left a reply on Stripe Charge Failing

Can you post an updated CheckForm.vue?

jlucia left a reply on Stripe Charge Failing

You would need to bind the token and email values before the post to use this.$data.

this.stripeToken = token.id;
this.stripeEmail = token.email;

jlucia left a reply on Stripe Charge Failing

You could add a console.log(this.product); to your buy method. It should show the id value change as your change the dropdown. At least you know it is accepting that.

jlucia left a reply on Stripe Charge Failing

Does this give you a different outcome?

axios.post('/purchases', this.$data)

jlucia left a reply on Stripe Charge Failing

Sorry for the typo before. Can you confirm you have a product in your products table? If you do, what happens if you hardcode the product: 1 in the post?

jlucia left a reply on Stripe Charge Failing

Your post to the /purchases doesn't seem to include the product in the request. Try adding this.product to the post after the stripe data.

27 Apr
2 years ago

jlucia left a reply on [Network] What Is The Longest A Dynamic IP Can Be Assigned?

Maybe it is using IPV6 and it has no real need to change.

jlucia left a reply on I Get An Error When Running The Command 'mysql -uroot -p'

Yes, that should be fine also. I edited the symlink, I had it backwards.

jlucia left a reply on I Get An Error When Running The Command 'mysql -uroot -p'

Your server mysql socket is starting in a different location than the .cnf is looking.

Run this at your own risk, but I think it may work for you.

sudo ln -s /var/run/mysqld/mysqld.sock /opt/lampp/var/mysql/mysql.sock

service mysqld restart

jlucia left a reply on [Network] What Is The Longest A Dynamic IP Can Be Assigned?

I don't see why it couldn't. It's unlikely the modem is causing it to be static. If you shut it down for an hour and turn it back on you would likely get a new address.

jlucia left a reply on I Get An Error When Running The Command 'mysql -uroot -p'

Are you sure the mysql service is running?

What do you get when you type ps aux | grep mysqld ?

25 Apr
2 years ago

jlucia left a reply on How To Use Unique In Edit Record?

You will need some way of passing or fetching the id of the field to exclude.

$this->validate($request, [
    'name' => ['required', Rule::unique('store_items')->ignore($storeItem->id)]
]);
24 Apr
2 years ago

jlucia left a reply on VueJS 2 Debounce

Is there any particular reason you want to avoid lodash? It works pretty well with Vue.

23 Apr
2 years ago

jlucia left a reply on Problem In Showing Errors In Right Place

If you look at the error messageBag you will see it is not returning the invalid credentials at the password key.

To confirm, add this to your view and look at the response.

@if($errors->any())
    {{ dd($errors) }}
@endif 

jlucia left a reply on Problem In Showing Errors In Right Place

Where do you want to show the error? You do something generic like this at the top of the page and remove the errors from the inputs.

@if($errors->any())
    <div class="alert alert-danger">
    @foreach ($errors->all() as $error)
        <li>{{ $error }}</li>
    @endforeach
    </div>
@endif 

jlucia left a reply on Ajax Table Update Inserts <br> In Database, Why?

Can you post some code? Did you do a dd($request->all()) to see if the <br> is in the request?