eugenevdm

eugenevdm

Member Since 4 Years Ago

Experience Points
128,035
Total
Experience

1,965 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
1269
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 26
128,035 XP
May
29
2 days ago
Activity icon

Started a new Conversation 403 Forbidden When Changing App From APP_ENV=local To Production

I'm testing an API using Postman. I am posting with Body form_data and api_token is a parameter.

This works perfect on my Forge server if I change the APP_ENV to local

But of course this is a production server, and every time I change APP_ENV to production I get 403 Forbidden.

I should point out this is a Laravel Forge server. I've turned logging on in the NGINX file, and this is the what is displayed:

x.y.189.140 - - [29/May/2020:23:42:29 +0000] "POST /api/v1/product HTTP/1.1" 403 50 "-" "PostmanRuntime/7.25.0"

This is how I am protecting my routes:

Route::group(['prefix' => 'v1', 'middleware' => 'auth:api'], function () {
    Route::post('/product', 'Api\[email protected]');
});

Please help.

May
22
1 week ago
Activity icon

Started a new Conversation Submit VueJS Form With Child Component Values Post Axios Call

I have a VueJS form with dynamic variables that I want to populate just after an Axios Ajax call that fetches essential parameters from the server. Because the child component is included early on the page, none of the form values are populated as one would expect. They are all blank.

If you block the Axios call from submitting the page, and I submit the Axios call again, the form is populated.

I guess I'm fishing for a way to "force" Vuejs to include the child component just after I've made the Axios call.

Below is a snippet of the form. I use a "ref" tag as shown later to submit the form. The child is dynamically populated after an Axios call.

<template>

    <div v-if="$store.state.cartItems.length > 0">

        <form ref="form"
              @submit="checkForm"
              method="post" :action="gateway.destination">

            <input type="hidden" name="_token" :value="csrf">
            <input type="hidden" name="order_id" ref="order_id">
            <input type="hidden" name="payment_method" ref="payment_method">

            <payfast-component
                    v-if="payment_method ==='payfast'"
                    :gateway="gateway"
                    :user="user"
                    :order="order">
            </payfast-component>

Here is where I submit the form:

// Post email, paymentMethod, and the cart data so that a new order is placed
                axios.post('/api/v1/order', data).then(res => {
                    eventListener = false;

                    console.log(res.data.data.order.id);

                    this.order = res.data.data.order;
                    this.gateway = res.data.data.gateway;

                    // Clear the cart
                    window.localStorage.setItem('cartItems', '');
                    window.localStorage.setItem('cartCount', '');
                    // Set order_id hidden value
                    this.$refs.order_id.value = this.order.id;

                    // Submit the form
                    this.$refs.form.submit();

                    this.disableSubmitButton = false;

                    return true;

So the problem is this.$refs.form.submit(); submits the form, but all the values are blank.

If I disable submission, and then press submit again, all the values are populated.

So the child component's data isn't included but I would like it to be included.

I'm open to doing this another way as well but struggled to do it via a controller.

Apr
28
1 month ago
Activity icon

Started a new Conversation When You Create An Image For A Product Which Goes First? :-)

Guys I'm torn and I think PHP also got this wrong a long time ago.

When I create an image for a product, do I do:

A:

$this->createImage('image.png', $product);

or

B:

$this->createImage($product, 'image.png);

Please put me out of my misery. Am I creating an image for a product, or a product image? Which goes first, the variable to where I'm putting or the assigned value?

Activity icon

Replied to Use CSS Style Image Width And Height With Nova

Sweet thanks @bobbybouwmann that worked perfectly. I also changed the CSS afterwards to use em instead of px but that was my design problem, and nothing to do with the original question :-)

Apr
27
1 month ago
Activity icon

Replied to Remembering User For Front-end Authentication Post User Creation From Custom Form

Hi again @snapey , after your question which seemed rather trivial I decided to go back to basics. I created a fresh Laravel project and a UI and migrated and then did a test route.

Auth::loginUsingId(1); works in the fresh project, so I guessed something wrong in my application. Then on closer inspection I noticed that this Auth::loginUsingId is called from an API route, instead of a web route. I moved it out of the API route and into Web route and now it works!

Thank you, I'm thinking your questioning actually made me go back to basics and solve the problem!

Activity icon

Replied to Remembering User For Front-end Authentication Post User Creation From Custom Form

Hi @snapey I'm just referring to the default authentication scaffolding. I am naively expecting after running loginUsingId that the front-end scaffolding would report that the user is logged in.

Activity icon

Started a new Conversation Remembering User For Front-end Authentication Post User Creation From Custom Form

I have a shopping cart page which submits both the shopping cart details and the new user's registration details at the same time.

In my NewOrders controller I create a new user:

$user_id = $this->createUser($form)->id;

I then log on the user:

Auth::loginUsingId($user_id, true);

This seems to work for the back-end, but not the front-end. On the back end I test like so:

Log::debug(Auth::user()->id);

The correct ID appears, so I am assuming the back-end is happy.

The problem is the front-end is not authenticated. Normally at the top right, where you can see a user is logged in, it's still asking to Login or Register.

I'm guessing I'm missing some fundamental session creation code and Auth::loginUsingId doesn't just produce this.

Could any give me a clue how can I create a user, then also have this user authenticated in the front-end, all from code instead of having to submit the default login form?

Apr
24
1 month ago
Activity icon

Started a new Conversation Use CSS Style Image Width And Height With Nova

I'm trying to apply a CSS style class to an image preview field in Laravel Nova, but I'm not sure if it's possible. I've tried this:

Text::make('Image Preview 1', function() {
                return "<img src={$this->image_url_1}>";
            })->asHtml()->withMeta(
                [
                    'style' => 'height=20px;width=auto'
                ]
            ),

and I've tried this:

Text::make('Image Preview 1', function() {
                return "<img src={$this->image_url_1}>";
            })->asHtml()->withMeta(
                ['extraAttributes' => [
                    'style' => 'height=20px;width=auto']
                ]
            ),

Neither worked. I've scouted the documentation and google and just really struggling to find out if this is possible. Any clues?

Apr
19
1 month ago
Activity icon

Replied to Can One Use Both Tailwind And Bootstrap 4 At The Same Time?

I had a long hard thought about this, and I came to the conclusion it's not possible to run two CSS frameworks at the same time. It doesn't make sense. It's the same as saying one wants to run Laravel and Codeigniter at the same time. It simply doesn't make sense.

Apr
18
1 month ago
Activity icon

Started a new Conversation Can One Use Both Tailwind And Bootstrap 4 At The Same Time?

I am trying to ease myself into Tailwind. My Laravel UI is currently Vuejs which seems to use Bootstrap 4 CSS as well.

I was hoping that I would load Tailwind and still have Bootstrap operational as I start moving over.

I am aware that there are presets for Tailwind and the UI, but I would prefer to build it up slowly instead of suddenly diving into a new UI that is already completely Tailwind.

I'm having a real challenge getting both to Tailwind and Bootstrap 4 work together. Perhaps they are not supposed to?

So far I have done:

composer require laravel/ui
php artisan ui vue --auth
install npm install tailwindcss

In app.scss

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

// Variables
@import 'variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';

// Font Awesome added post installation
@import "node_modules/font-awesome/scss/font-awesome";

@tailwind base;

@tailwind components;

@tailwind utilities;

Here things already go wrong, Font Awesome suddenly can't install.

ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/css-loader/index.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../fonts/fontawesome-webfont.eot' in '/home/eugene/code/shop/resources/sass'

No problem, I comment it out as I'll figure that out later.

//@import "node_modules/font-awesome/scss/font-awesome";

At this point I am lost!

According to the Tailwind documentation I must "Process your CSS with Tailwind" and then the only reference to Laravel is if you're using plain CSS. See below

Laravel Mix

If you're writing your project in plain CSS, use Mix's postCss method to process your CSS and include tailwindcss as a plugin:

Am I supposed to include it? Or not?

When I do include it, and my webpack.mix.js file looks like this:

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

mix.postCss('resources/css/main.css', 'public/css', [
    require('tailwindcss'),
])

Tailwind classes do not work on the front-end.

I guess if it's completely impossible to use both Bootstrap 4 and Tailwind together, a quick HOWTO on getting Tailwind working will also be fantastic as the proper install manual is confusing me as a Laravel user.

Apr
13
1 month ago
Activity icon

Replied to PhpUnit And Access To External URL

I've stumbled upon this post because I also want to know, with PHPUnit and Laravel testing, is it possible to specify and external URL when testing? I'm specifically referring to the following commands:

$response = $this->getJson($uri)

$response = $this->postJson($uri)

I imagine it's not common practice because I guess you have to mock, it's just my current workflow often starts with a few tests and when I start and before I know the API I like to start in the /tests folder.

I tried external URLs in PHPUnit and Laravel testing, but I get this:

"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",

Please advise.

Apr
01
1 month ago
Activity icon

Started a new Conversation App.scss Imports Google's Font, But When Internet Down Page 1 Minute Timeout

I have a stock site. At the top line of my app.scss I have an import for Google's font:

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

My expectation is that the fonts are downloaded to the local machine. However, when the internet goes down the page take a minute to load as it first has to time out.

See here: https://imgur.com/a/N8MWRmR

Am I doing something wrong?

Mar
29
2 months ago
Activity icon

Replied to JQuery Or $ Is Not Defined Even Though Bootstrap's JS Components Seems To Be Working Ok?

Thanks @helmchen , elegant solution, if I "just remove defer" then Vuejs stops working.

Mar
20
2 months ago
Activity icon

Replied to Encrypting Model Data

Hi @milescato and @martinbean ,

Thank you for this incredible post. I concur with @milescato that to avoid "The payload is invalid" you have to check for empty values. I found this out by just copying / pasting @martinbean 's original example in my Laravel Nova application. The other question I have is why Martin's original example didn't include the return statement? Anyway, for it's working beautifully and I love the elegant way one is able to do these things in Laravel. What a winner!

Mar
17
2 months ago
Activity icon

Started a new Conversation Is It Possible To Bypass "Confirm Action" In Nova

I have a specific application, in this case, "Generate PDF", which is a Nova Action.

I feel after selecting "Generate PDF" from the dropdown, and then also pressing "play button", it's unneeded to confirm action.

Is it possible to bypass confirm action in Nova?