KLM113

KLM113

Member Since 2 Months Ago

Experience Points
3,450
Total
Experience

1,550 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
26
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 1
3,450 XP
May
31
22 hours ago
Activity icon

Replied to SQLSTATE[HY000] [2006] MySQL Server Has Gone Away

It seems it's being caused by the mysql option I had to add to allow LOCAL IN FILE.

[PDO::MYSQL_ATTR_LOCAL_INFILE => true]

Not sure what's wrong with it tho.

Activity icon

Replied to SQLSTATE[HY000] [2006] MySQL Server Has Gone Away

Now that I check even the simplest query causes this issue

SHOW VARIABLES

Returns the same problem

Either with

$pdo->exec()

or

DB::statement()
Activity icon

Replied to SQLSTATE[HY000] [2006] MySQL Server Has Gone Away

Digging on the debugging info I found the exception is thrown before the query , just here

$pdo = DB::connection()->getPdo();

Maybe there is a way to do this on eloquent?

May
30
1 day ago
Activity icon

Replied to SQLSTATE[HY000] [2006] MySQL Server Has Gone Away

Thanks, I tried that but made no difference. I have executed 20x bigger queries on this server, I doubt is that kind of issue.

Activity icon

Started a new Conversation SQLSTATE[HY000] [2006] MySQL Server Has Gone Away

I know this is usually caused by very large queries however in my dev server the errors pops immediately after the request is executed.

This is the query causing the problem (the error appears on other queries that work fine if I don't run this one)

$pdo = DB::connection()->getPdo();
$pdo->exec("
	LOAD DATA LOCAL INFILE '".storage_path('data.txt')."' INTO TABLE raw FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' 
	(my_fields_here)
");

Data file is under 100k

And just in case the my.cfn

[mysqld]
default_storage_engine=innodb
# character-set-server=utf8
innodb_file_per_table=ON
#innodb_file_format=Barracuda
innodb_flush_log_at_trx_commit=1
max_sp_recursion_depth=255
max_allowed_packet=1000M
query_cache_size=0
query_cache_type=OFF
sql-mode=""
wait_timeout = 28800
innodb_log_file_size = 128MB

Server version: 10.3.22-MariaDB-1 Debian buildd-unstable

Thanks in advance for any help.

Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

Hadn't testing it so much but so far it's working, thanks!

May
23
1 week ago
Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

@MichalOravec hadn't the chance to test it yet, I'll let you know

May
22
1 week ago
Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

Thank you will give it a try

May
21
1 week ago
Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

@michaloravec it causes the same problem I mentioned before, ie:

[2020-05-21 20:58:43] local.ERROR: Uncaught exception 'ErrorException' with message 'Undefined index: file' in /home/xxx/app/Exceptions/Handler.php:45
Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

I thought laravel had a straight way to handle this.

Activity icon

Replied to How To Turn Laravel Logging In Something Readable?

I already did, and tried most voted answers, most of the time it doesn't work because undefined indexes.

Activity icon

Started a new Conversation How To Turn Laravel Logging In Something Readable?

How can I get rid of all the stack trace and just log the error itself?

May
03
4 weeks ago
Activity icon

Replied to Files Automatically Deletes

Hard to know what's going on with that vague explanation, provide more details.

Apr
28
1 month ago
Activity icon

Replied to Subtract Column Value From Sum() Of Another Column

Thanks @frankincredible I ended doing it in 2 queries but I'll give your method a try anyway.

Apr
27
1 month ago
Activity icon

Started a new Conversation Subtract Column Value From Sum() Of Another Column

$month_revenue = Sale::whereMonth('payment_date', $month_label)->whereYear('payment_date', $year_label)->sum('total');

I need to subtract shipping_cost column from this query, would it be possible with eloquent?

Apr
25
1 month ago
Activity icon

Replied to Get String Outside And Inside Brackets?

$tokens = explode('[', 'filter[name]');
$outer = $tokens[0];
$inner = substr($tokens[1], 0, -1);
Apr
11
1 month ago
Activity icon

Replied to Job Chances For A 40 Year Old Developer

It depends on many other things...

Where do you live? For example I'm located at a small city in a underdeveloped country, IT jobs don't exist here.

That leads to the next point: Are you willing to relocate? If the answer is no then your only chance is to do home office and that's really hard to get if it's your first job, or at least it was before all the virus mess started.

Also, do you have a degree and/or a specialization? All those things count.

Apr
09
1 month ago
Activity icon

Replied to .

.... --- .-- / -.-. .- -. / .-- . / .... . .-.. .--. / -.-- --- ..- ..--..

Apr
05
1 month ago
Activity icon

Replied to Send Mail

Use a proven library like PHPMailer. PHP mail() doesn't even provide authentication functionality.

Apr
04
1 month ago
Activity icon

Replied to IMAP Email

I'm not sure what are you trying to do, but you are not supposed to know your users' passwords. If your goal is just to force them to use a common credentials for both services you can programmatically create the user's email account when they sign in your app, that's the only moment when you are supposed to have the password in plain text.

Apr
02
1 month ago
Activity icon

Replied to Migration Files Getting Out Of Hand

I totally skip them, the whole system is a mess.

Mar
30
2 months ago
Activity icon

Replied to WYSIWYG Editor On The Laracasts

Uh? That's a syntax highlighter not a WYSIWYG editor.

Mar
29
2 months ago
Activity icon

Replied to APP_DEBUG On Sharing Host Laravel

I'm just guessing due the lack of details but note the root of your virtualhost must point to the public folder of your app. In most cases you don't have control of this, being in a shared environment, but you can symlink it to any other path under your home directory. Otherwise ask your hosting provider to modify it for you. Of course, this is in case the problem is not anywhere else, as I said, I'm just guessing.

Mar
27
2 months ago
Activity icon

Replied to I Keep Re-writing My Code Whenever I Learn Something New

That's called refactoring and it's pretty normal. Nothing wrong about it as long you know the new code is better than what you had before.

Mar
23
2 months ago
Activity icon

Replied to Multiple Domain Single Application

If I understand correctly you should implement this at web server level. Normally you simply create as many virtual hosts/server blocks as needed, and then point them to the same "docroot".

IE Nginx:

server {
        listen 80;
        server_name mydomain.com;
        root /var/www/html/my_app/;
}

server {
        listen 80;
        server_name anotherdomain.com;
        root /var/www/html/my_app/;
}

Or perhaps what you are asking is how to tell the app what's the domain in use?

Mar
22
2 months ago
Activity icon

Replied to Auth Middleware, Allow Specific Users Only

Thanks @signar, is there any difference doing it in a custom middleware?

Activity icon

Started a new Conversation Auth Middleware, Allow Specific Users Only

I add the routes that require the user to be authenticated in a block like this

Route::group(['middleware' => ['auth']], function() {
});

But how can I only allow users with a specific id or even when other fields have certain values?

Can the middleware handle that or at least can I do the check myself inside this block so I don't have to repeat it on every single route?

Mar
13
2 months ago
Activity icon

Replied to What's The Best Approach For A Multiple Images Upload System?

I was mostly trying to read some experiences, I know there are a bunch of guides and tutorials out there. Thanks anyways.

Activity icon

Replied to What's The Best Approach For A Multiple Images Upload System?

because this is exactly the same as submitting files with the form using regular file inputs. You craft a method to upload files as base64 and don't achieve anything different to standard form file input

It's not the same since this way you can reuse a single input to handle multiple files.

Anyway, my main goal is to keep everything client side and send everything at once. That's what I would like to read about.

Activity icon

Replied to I Lost My Motivated To Coding :(

I'm my opinion there are only 2 ways you get enough motivation to sit every day and start coding:

1- You are getting paid well enough for it.

2- The software you are developing is something you really want/need to use.

I work as freelance developer and fortunately right now I have enough clients but I have had some bad times where jobs didn't come and then yes, it's hard to not get that feeling you are wasting your time.

Activity icon

Replied to What's The Best Approach For A Multiple Images Upload System?

I already stated some of the cons before, you need to keep track of those files and take care of deleting them if the user decide to discard the post, which you don't have a reliable way to determine.

Now I ask you @snapey: What is wrong with what I suggested? Can you substantiate your opinion?

Activity icon

Replied to What's The Best Approach For A Multiple Images Upload System?

Thanks for the advice.

What about if I base64 encode every image and store it in a hidden input? Does that make sense to you guys?

Activity icon

Started a new Conversation What's The Best Approach For A Multiple Images Upload System?

The tricky part at least for me is to keep everything client-side until the form is sent, otherwise I'd have to save and restore every single input with every new upload, plus I'd need a temporal storage and I'd have to implement some mechanics for deleting those images where the user didn't complete the post.

At the same time I need to server-side check the attributes of the image the user is trying to upload are valid/allowed.

Any thoughts?

Activity icon

Replied to Nested Categories, How To Fetch A Full Branch?

@sinnbeck yes I'm aware, I'm still considering using it but I'd like to keep things simpler as possible.

Activity icon

Replied to Nested Categories, How To Fetch A Full Branch?

@ahmeddabak thanks for your time, tested your updated code, now it returns only the first immediate subcategory even for top level categories.

Mar
12
2 months ago
Activity icon

Replied to Nested Categories, How To Fetch A Full Branch?

Thanks mate, tried your code and it seems to return just the first immediate subcategory but not the rest.

Activity icon

Replied to Are Laravel $request Parameters Sanitized By Default?

I'm fine as long as queries are processed through prepared statements, but I'm not sure if this is fully implemented in Laravel, for instance does query builder support them?

Activity icon

Started a new Conversation Nested Categories, How To Fetch A Full Branch?

This is not laravel specific but more a logic question.

+------------+--------------+------+-----+---------------------+-------------------------------+
| Field      | Type         | Null | Key | Default             | Extra                         |
+------------+--------------+------+-----+---------------------+-------------------------------+
| id         | int(11)      | NO   | PRI | NULL                | auto_increment                |
| name       | varchar(100) | NO   |     | NULL                |                               |
| locator    | varchar(100) | NO   | UNI | NULL                |                               |
| parent_id  | int(11)      | NO   |     | 0                   |                               |
| level      | tinyint(1)   | NO   |     | 0                   |                               |
| created_at | timestamp    | NO   |     | current_timestamp() | on update current_timestamp() |
| updated_at | timestamp    | NO   |     | 0000-00-00 00:00:00 |                               |
+------------+--------------+------+-----+---------------------+-------------------------------+

Having this schema and a category id, how can I -in a simple way- retrieve the id of every single category under that branch? There is no limit on how many subcategories can exist under a top level one.

Thanks in advance.

Activity icon

Started a new Conversation Are Laravel $request Parameters Sanitized By Default?

As title, thanks.