WebKenth

WebKenth

Member Since 3 Years Ago

Aalborg

Web Developer at Wexo A/S

Experience Points 67,730
Experience Level 14

2,270 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 404
Lessons
Completed
Best Reply Awards 43
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.

23 Apr
2 months ago

WebKenth left a reply on How To Use Api_token

@EMFPC - if you read the https://laravel.com/docs/5.8/authentication#adding-custom-guards you would find that you can add your own guarding policies and check for the token. Since you are not using the built in api_token feature with the Auth middleware you have to implement that logic your self

WebKenth left a reply on Create A Package Based On Another Library

You could always move the logic till you actually need it.

How do you want the user to use your Api instance?

ex: heres an Api that fetches all orders

Api::orders()->get();

in the orders() function you could add the logic when you dispatch the request

public function orders(){
    $config = config('api.config');
    $api = self::create($config['token'],$config['key'],$config['sandbox']);
    $response = $api->dispatch();
    return collect($response);
}

WebKenth left a reply on Prevent Making Request For The Same Image Multiple Times

Depending on how you use the image in your javascript if the link to the image is the same the browser will handle it ( check you dev tools network log and notice that the image is only fetched once, as long as it is the same content from the url )

If you use v-if with vue the image will load multiple times each time you toggle the conditional however the browser will still have the image cached.

WebKenth left a reply on How Do E-commerce Orders Process Work When Checkout?

Most e-Commerce systems have a temporary order object sometimes reffered to as a Quote which could be considered the cart. this contains all the information needed to create an actual order.

Some payment systems however require an actual order_id before a transaction can be made so some e-commerce systems will actually be forced to create an incomplete order and await the client input ( usually they have a timeout of 30-60 minutes before they cancel / delete the order in order to clean up after customers who close their payment gate too early )

You could take a look at Magento and see how they do it https://omsdocs.magento.com/en/getting-started/order-flow/

They have an extensive knowledge though their codebase is abit jerky compared to more modern shop frameworks like shopify and shopware

WebKenth left a reply on Ajax Response "Malformed UTF-8 Characters, Possibly Incorrectly Encoded"

Just out of curiosity why don't you just return $properties;? The controller will automatically transform your data to JSON and since you are not modifying the Response in any way ( like adding a different status) there's really no need to make one

09 Nov
7 months ago

WebKenth left a reply on Retrieving Resource From Custom Field

Ok so this is a REALLY hacky solution You can resolve the fields value and pass it a json array of the model like so:

YourNovaFieldHere::make('Name')->resolveUsing(function () {
    return json_encode($this->toArray());
}),

And then in your FormField.vue file you can on created() parse it and now you have access to the model data

WebKenth started a new conversation Retrieving Resource From Custom Field

I have a form field where i want to use information on the current Resource however the form field is only passed 'resourceName', 'resourceId', 'field' in its props. Missing the resource

When looking at components like nova/resources/js/components/Detail/TextField.vue i can see it expects a resource prop.

Anyone know how to retrieve the resource?

I could "just" make an API call to fetch the resource since i have the id, however it is already loaded and would seem like a dirty hack.

21 Nov
1 year ago

WebKenth left a reply on Create, Use And Modify A Variable In Blade

Don't use views to handle logic

Handle your logic in your controller or model and pass the variable to the view

This will make your views cleaner and easier to debug when you find an error

12 Nov
1 year ago
28 Jul
1 year ago

WebKenth left a reply on Search Eloquent Items

Filter through your data before sending it to the view?

don't clutter your view with logic

WebKenth left a reply on Call To A Member Function Count() On Null

Your $post variable is null so you can't call ->count()

rather than checking if $post has a count why not just ask if you have a post?

WebKenth left a reply on Laravel Mix Copy Happening After Compile Of Files (Laravel 5.4)

Just wondering why are you are using mix twice? I'd guess that each pipe does it thing first before continuing to the next in the chain so it should be:

mix.copy('vendor/zurb/foundation/js', 'resources/assets/js/foundation', false).copy('vendor/zurb/foundation', 'resources/assets/sass/foundation', false).js('resources/assets/js/app.js', 'public/js/footer.js').sass('resources/assets/sass/app.scss', 'public/css/').version();

Side note: Rather than copying ressources every single recompile why not just reference them?

@import "filelocation" or require('file.js');

WebKenth left a reply on Keep Getting Error 405 "The Specified Method For The URL Is Invalid" With PATCH And DELETE Request Method

Have you allowed Patch, Delete requests in your server config?

WebKenth left a reply on How To Get Database Backup As .sql File Only When Click On A Button. No Command Line Needed

Put your code in back ticks ` so we can read them

like this

(code) => code.prettify

As for your problem i would probably trigger a console command to export your database to a file on your server, and when it's done then serve this file to the user

WebKenth left a reply on I Am Planning A Management Tool: Should I Use Vue For The Frontend?

Start with an entrypoint like the home.blade.php file (made with php artisan make:auth) from here you put your main vue app

You then define the routes for vue and what components it renders

Any data you wish to get has to be served via XHR requests. So you need to create routes in Laravel to define your data endpoints

Make your models and controllers and serve data via these end points.

Now you have basically separated your entire application, one for front-end and one for the back-end

WebKenth left a reply on I Am Planning A Management Tool: Should I Use Vue For The Frontend?

I would definitely give it a try if i were you

Vue does a lot of the work for you and if you keep it simple like only using @click, v-for, v-show and the likes you can quickly get a powerfull application running.

From there you can easily extend it to become more complex and if you're up for it attempt to turn it into a Single Page Application (SPA).

26 Jul
1 year ago

WebKenth left a reply on Laravel 5.5 Release Date?

When it's ready

21 Apr
2 years ago

WebKenth left a reply on Laravel Valet Does Not Work Without Internet

Turn off your wifi, when it's looking it tends to cut off any attempt at localhost

19 Apr
2 years ago

WebKenth left a reply on Vue , Ajax, And Select Components

How did you solve it?

If someone stumbles across this thread they will never know the answer you found!

07 Apr
2 years ago

WebKenth left a reply on Different Specification For Different Category

When working with product infomation i would recommend a noSQL database as they are document based so your products can have any and all information they require regardless of the others

HOWEVER if you insist on using a Relational Database you should think carefully about your Schema's before you launch, because it can quickly get nasty if you have to make changes without affecting existing data

For inspiration heres a few helpful links about schemas Database Schema's Database Schema B2C Database E-Commerce Schema

WebKenth left a reply on Best Way To Check Log In Status And Prompt User To Re-login?

Either extend their session time or make a nasty ping script that sends a signal to your server to refresh your csrf token

WebKenth left a reply on How To Destroy Child Component In VueJS

Where are you getting your data from? Database or are you rendering the entire table and hiding the pages you don't want to show yet?

I assume you are getting a paginated object from your server and when you switch page you request the new data and let Vue generate the view?

When you create the new row are you also inserting it into the database or are you simply adding it to the DOM?

06 Apr
2 years ago

WebKenth left a reply on Lavachart Display Count Each Months

Would it not be simpler to send an array with the data to your javascript and have it populate the chart instead?

Create an array which looks something like this:

[
  {
    Month: 'January',
    data: 100
}, {
    Month: 'February',
    data: 120
}, {
    Month: 'March',
    data: 90
}, 
]

Then from your javascript you just add the data to your HTML with chart.js or morris.js or any of the million libraries out there

WebKenth left a reply on Validation Problem?

Before you update the active to true on one record just run an update query to set all the others to false?

WebKenth left a reply on Form With Multiple Submit

@bac3928 add 3 of these ` back ticks before and after the code

Or add a tab(4 spaces) on each new line

05 Apr
2 years ago

WebKenth left a reply on Auth Login Is Not Working On My Online Server

Did you migrate the database?

Did you seed the database?

04 Apr
2 years ago

WebKenth left a reply on General Error Wrapper

The "Woops something went wrong..." page doesn't do it for you?

WebKenth left a reply on Mysql-Best Way To Avoid Id Increase On Duplicate Rows

Just make the column you put their ID unique and it won't allow duplicates

WebKenth left a reply on Mysql-Best Way To Avoid Id Increase On Duplicate Rows

How would you get duplicated rows?

Can you give an example?

29 Mar
2 years ago

WebKenth left a reply on How To Add Search Box In My Form To Fetch Data From Database

You write the HTML, CSS & JS to display the searchbox and then you write the logic in PHP in laravel to handle the search.

You could try and have a look at Algolia if you don't want to do all the search logic on your own

FYI this is not a place where we do your homework, show us what you have made or attempted and we will be happy to guide you in the right direction, but a question asking us to do your work will provide you with little information.

WebKenth left a reply on Htmlentities() Expects Parameter 1 To Be String, Object Given

Back to bootcamp with you!

When in a foreach loop you cannot instantiate a variable with the same name as the collection you are trying to access, otherwise the entire collection will be overwritten on the first run.

instead write it like this

@foreach($check as $item)
    {{ $item}}
@endforeach

if your item is an object do it like this

@foreach($check as $item)
    {{ $item->property }}
@endforeach

with property being the method/attribute you are trying to access

To figure out what you have in your array you could run a dd($check) in your controller

WebKenth left a reply on Ssh Connection Problem

Well there's your problem, you can't connect to xx.xx.xx.xx you would need a real IP for that ;)

Thank you, i'll be here all week

Back to seriousness:

a quick google revealed a possible solution

Port 22 is probably blocked as stated by this Stackoverflow Question he also provides a Solution

28 Mar
2 years ago

WebKenth left a reply on How To Call Mass Update Function If We Dont Have PK As Id ?

First of, why choose of_id instead of id?

And to fetch them simply add a new line below to fetch the updated of_ids

23 Mar
2 years ago

WebKenth left a reply on Count Voting Results

@twg_ Cache is faster than a database query for multiple fast insert/updates

Consider a site where you have alot of database queries

Would you add a ton of queries that or make a separate system to handle the load?

Jeffrey talked about what you could use Redis for in his demo of it.

Learn Redis through examples

22 Mar
2 years ago

WebKenth left a reply on Count Voting Results

Personally i would use Redis to count the votes and when the "election" has ended i would get the data and persist it in a table

If the votes run over multiple days i would make a backup of the votes at the end of each day or maybe twice a day

WebKenth left a reply on Cross-env Not Found On Npm Run Dev

Are you required to use a virtual machine?

Since you are using windows I would recommend using Laragon unless you are otherwise required to use a virtual machine.

You avoid all the hassle of setting up machines

WebKenth left a reply on Re-enable Vue Dev Tool

gulp will create a normal compile which you should use for development

you should only use gulp --production before you commit to production

16 Mar
2 years ago

WebKenth left a reply on API Returns 302 Instead Of 401

Step 1 find the endpoint probably in your api.php route file Step 2 go to the controller function Step 3 read it and understand why it redirects

Did you follow the steps in Laravel API Authentication

Or are you simply trying to login with the default Auth controller?

WebKenth left a reply on Set A Default Value In The Code

in your Schema all you need to do is set a default value with ->default('value')

That should take care of it, if the variable isn't set when you create the model

WebKenth left a reply on (SOLVED) Trying To Duplicate A Controller

@WebbieWorks That's PHP not Laravel

It would be a huge benefit to you if you took a day off to look at Jeffreys PHP Bootcamp

Then you would be able to catch most errors and understand the basics which is 90% of all problems

15 Mar
2 years ago

WebKenth left a reply on Storing Id And Displaying Corresponding Name From Two Different Table

Use eloquent instead of DB::table and create relationships between your model to easily get access to everything you need

Eloquent - Relationships

WebKenth left a reply on Since Laravel Mix PhpStorm Become Slow When Watch Is Running

Guessing you are running it all through PHPstorm terminal?

Have you tried running the command in a separate terminal window (not bound to PHPstorm)?

WebKenth left a reply on Best Way To Get Edit State Outside Of V-for?

Create a component to contain the logic of the input field

Feed it data via props and let it handle it's own custom events.

WebKenth left a reply on Adding A Require To Composer

if you added it to the Packagist Repository you could do the following

composer require caffeinated/modules=^4.0

or just manually add it in the main composer.json file?

If it's set to readonly just change the permissions on the file

WebKenth left a reply on Simple Form Wizard With Vee Validate

Vee Validate already is a plugin? what exactly are you looking for?

WebKenth left a reply on New To Laravel Api

Define your routes in routes/api.php and have your android app send requests to them. What exactly you want to do is up to you.

How you structure your controllers is up to you, you could add a subfolder in the controllers directory which would prefix your controllers like so: api/[email protected] this is not a requirement but could help you organize them

Bonus info: if you are are new to API's all together here's a good video explaining the steps of creating an API

Albeit it has a few years on it it's back but it lives up to the REST principles

ApiGee Webcast - Restful API design

14 Mar
2 years ago

WebKenth left a reply on Class App\Http\Controllers\RequestStaff Does Not Exist

Did you remember to composer dump-autoload?