RoboRobok

RoboRobok

Member Since 3 Years Ago

Experience Points 19,660
Experience Level 4

340 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 16
Lessons
Completed
Best Reply Awards 23
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.

28 Feb
2 weeks ago

RoboRobok left a reply on Laravel 5.9 Wish List

I am really looking forward for better relationship definitions. They shouldn’t have been methods declared on both ends (DRY). Maybe in Laravel 6.0?

25 Feb
3 weeks ago

RoboRobok left a reply on TDD CSRF Mismatch

Are you using the built-in CSRF solution? If so, there is no reason to test it. You should just disable it for testing.

23 Feb
3 weeks ago

RoboRobok left a reply on How To Make A Page Accessible Only By Clicking On A Button?

Can you tell me why you don’t want it to have an URL? It doesn’t add anything to the security, but certainly it does for annoyance.

RoboRobok left a reply on How To Hide All Popovers On Document Click - Except The One Clicked

Just hide all and then show the clicked one.

22 Feb
3 weeks ago

RoboRobok left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

To be honest, I believe the most reliable way to solve this would be to make this dropdown a partial view of its own. And then, you would use View::compose on that view. You could make this view take a class name for the element to style it individually, for example.

21 Feb
3 weeks ago

RoboRobok left a reply on Laravel And AJax On Localhost Working, But Online Ajax Request Not Working With No Reponse

There are a few great articles about CORS online. Basically, you need to include Access-Control-Allow-Origin header in the response, preferably setting it to whatever the Origin request header was, of course if the Origin is acceptable.

RoboRobok left a reply on How To Get Record In Between Range Of Quantity?

Another idea is to us eDB::raw() like this:

test::whereBetween(DB::raw(16), [DB::raw('min'), DB::raw('coalesce(max, ~0)')])->get()

RoboRobok left a reply on Grouping By 15 Days( 1 ~ 15 ) / ( 16 ~ End Of Month ).

Group by raw expression. I would go with day(billing_date) <= 15 as SQL expression. Some records will interpret it as 0 and some will as 1. Good to group by that.

RoboRobok left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

@SHAHRUKH4 - I was talking about using it in subviews as well. But if you load it just for the main layout, you can still pass it to the subviews that need it, without querying the database over and ober again.

20 Feb
3 weeks ago

RoboRobok left a reply on How To Make List Values Available For Multiple Controllers (drop Down View)

@shahrukh4 I'm pretty sure your code will call one SQL query per each subview, which I don't think is the best idea.

How about querying it for the main view only and then passing to any view that needs it? Or binding that to the container?

RoboRobok left a reply on Standard Deviation Funtion?

@fbc if you mak your own helpers, try to stick to PSR standards and use camel case.

Also, as a rule of thumb, I think it's better to always use static instead of self, just to avoid surprised or bugs that are difficult to track whenever you extend your classes.

RoboRobok left a reply on Standard Deviation Funtion?

@cronix because global lookup works just for functions, not classes, traits etc.

RoboRobok left a reply on Does This Forum Support Emoji Of Any Kind?

It came out as a JPG.

But seriously, any other way?

RoboRobok started a new conversation Does This Forum Support Emoji Of Any Kind?

Emojis are converted here to question marks, standard Markdown like :smile: doesn't work neither, no luck with :) :D etc.

Is there any other way to post smileys here? If not, how about making it handle regular emoji just like our Laravel does?

RoboRobok left a reply on Standard Deviation Funtion?

Maybe an easter egg, haha ?

RoboRobok left a reply on Why Does This Website Go Back In Time When I Refresh It?

It's possible that it only works like that for new articles. I added one comment today and have experienced that, but also I've done the same in the past.

If you'd like to test, just casually open the website in a few minutes (they add news regularily), but keep in mind that it's now 3:34 am in Poland and they add news between 9 am and 12 am or something like that.

It's bad enough to be experienced even many minutes after the news has been added. I tried now too and it's consistent at the moment indeed. I guess their cache gets a lot of time to sync.

RoboRobok left a reply on Standard Deviation Funtion?

@cronix functions in global scoppe don't need to be namespaced in PHP. If the function is not found under current namespace, PHP automatically tries to resolve it under the global namespace.

RoboRobok left a reply on Why Does This Website Go Back In Time When I Refresh It?

Absolutely, you can see it. I didn't want to post the URL to avoid being called a spammer :D

The website is Pudelek (meaning 'little poodle' in Polish): www.pudelek.pl

RoboRobok left a reply on Code Shortcut For Route Function With Multiple Parameters

Hi Ray, I would consider using custom route parameter pattern, as described in Explicit Binding documentation, under Customizing The Resolution Logic section. You can add entire {country}/{city}/{post} combo as one URL parameter, returning whatever you like.

RoboRobok started a new conversation Why Does This Website Go Back In Time When I Refresh It?

There is a huge gossip website that behaves very weird. Every time you refresh, it shows you a different state of comments, like different point of time. You see there are 30 comments. You refresh, it's 32. You refresh again, it's 29. Then again 30 etc. And it's not just about the counter, there are actually that many comments displayed. Also, the thumbs up and down seems to reflect that point of time too. And this website is like that for years now, despite being a huge success.

My question is, how common that issue is? Can that be called purely bad content distribution and/or caching? Or is it something that cannot be avoided in some projects?

It's really annoying issue. Sometimes you write the comment and it required you to refresh several time to see it. And sometimes, if you refresh after seeing in, it's gone again. I guess it's not very common.

I would love to understand what can be some potential reasons for this behavior.

08 Feb
1 month ago

RoboRobok started a new conversation Event When Clicking To Open Page In A New Tab

Hi guys,

is there any JavaScript event fired when we open page in a new tab, like cmd+click on macOS? I'm pretty sure there's no event for that, but I think it would be extremely useful.

Many Single Page Apps don't behave correctly when using that feature. They will open the content in a new tab, but also change the content on the current tab. That's because they handle click event. For what I am aware of, some frameworks implement additional checking if a key is pressed, but it's pretty lame to assume the shortcut. Would be really cool if either of those were implemented:

  1. Additional data on click event, like: extra: "new_tab".
  2. Separate event for opening page in new tab/window, which I guess would be best if not fired when we right-click and select the option from the dropdown.

What do you guys think? And where would you send a proposal for that?

24 Jan
1 month ago

RoboRobok left a reply on How To Handle Contenteditable Input With Emojis Safely?

I'm not an expert of Vue.js, but doesn't it just output emoji correctly? Maybe it has something to do with the way you store them? Laravel handles emoji like magic when they are stored in utf8mb4 SQL charset.

RoboRobok left a reply on How To Handle Contenteditable Input With Emojis Safely?

I hate it when people remove tags that came from the input. People speak human language, your website uses HTML behind the scenes and consumer doesn't and shouldn't care. Your job is to safely display whatever has been typed by the user. If someone wants to type <b>, let him type it and display it just as it was typed.

Trimming HTML from typed input is like censoring words in completely irrelevant language. This habit is ridiculous.

RoboRobok left a reply on Trying To Get Property 'name' Of Non-object

It's null, which means that there is no Category of the given ID. By the way, use the ->find($id) method instead of where() with ID + first().

RoboRobok left a reply on Two Components In View: Laravel

That's fine, but Vue components have nothing to do with Laravel. I think you could start from learning the difference between server-side and client-side.

RoboRobok left a reply on Two Components In View: Laravel

What does Blade have to do with it?

23 Jan
1 month ago

RoboRobok started a new conversation Trailing Slash On Homestead

Hi guys, does Laravel perform trimming trailing slashes for Nginx? I can be wrong, but I think that in the past Homestead has been removing them (redirecting /foo/ to /foo). It's still present in .htaccess, so it's working for Apache, but what about other servers, including Homestead?

RoboRobok started a new conversation Focusing Chrome Window With Undocked Dev Tools

Hi guys, is there a way to make it unnecessary to explicitly focus Chrome window when using undocked dev tools?

It's quite annoying when I'm inspecting elements and need to click twice to make it work. Would be much more convenient if it didn't work as separate windows with own focus contexts, or at least automatically shifted focus when it makes sense.

I'm on macOS Mojave.

09 Jan
2 months ago

RoboRobok left a reply on Best Data Type Is For Storing Money Values

19,4? Come on, that's waaay too much. There is not even that much money in the world ?Also, why y? Unless it's for currency exchange or similar, it should be e.

I usually use something like 9,2

RoboRobok left a reply on How To Get Monthly Users Month By Month For A Table

@lawkunchi try this:

$monthlyCounts = DB::table('users')
    ->selectRaw('month(created_at) as month')
    ->selectRaw('count(*) as count')
    ->groupBy('month')
    ->orderBy('month')
    ->get()
    ->pluck('count', 'month');

RoboRobok left a reply on Most Convenient Mobile Testing

Dev tools for mobile? I like it on Safari that I can actually inspect the real mobile content. It makes a difference from emulated rendering, which is often not the same.

RoboRobok left a reply on How To Get Monthly Users Month By Month For A Table

@digitalized are you aware that this is extremely slow? You shouldn't just casually get all records and process the collection like that.

@lawkunchi I know you don't have a column. That's why I called a month(created_at) function.

RoboRobok left a reply on How To Get Monthly Users Month By Month For A Table

To make it efficient, you need to use GROUP BY in SQL query, as described in the documentation.

Something like this: SELECT month, count(*) as total FROM users GROUP BY month(created_at) as month

I'm assuming you know what you are doing with that, because most likely you also need to limit it to a certain year.

RoboRobok started a new conversation Most Convenient Mobile Testing

Hi guys, is there some convenient way to test web apps on mobile, let's say iPad? My dream scenario would be like this:

  • Wireless!
  • Using Google Chrome dev tools just like it's possible with Safari
  • Sending entire content to mobile on request, without any overhead of deploying changes

In other words, I would just edit my code and then refresh on mobile. Is there any industry standard for such workflow?

The closest I've seen is Safari with mobile developer tools, but I need to host and deploy my app on public servers. Also, Safari dev tools are not as good as Chrome's imho.

21 Dec
2 months ago

RoboRobok started a new conversation How To Configure PHP Code Sniffer For Sublime Text 3?

Hi guys, I'm using Sublime Text 3. I also use SublimeLinter-phpcs package, but I never know how to configure it. The docs are so confusing.

How to set it in Sublime to use PSR-2, but disable some of the rules, like requiring the file doc and a few others?

RoboRobok left a reply on How To Handle Listing Multiple Model Types?

Right. Are you sure about this though?

$query->where('document.user_id, $user->id);

I don't think you can nest where like this. It produces the error:

Unknown column 'document.user_id' in 'where clause

RoboRobok left a reply on How To Handle Listing Multiple Model Types?

And how do I make a collection of particular document out of it?

RoboRobok left a reply on How To Handle Listing Multiple Model Types?

When I said „grouped” I didn’t mean to use groupBy xD I meant all together, with being able to do things like „taking 10 newest documents of this user”. That’s not possible that way, because I would need to fetch all and trim the result, which will be super slow.

RoboRobok left a reply on How To Handle Listing Multiple Model Types?

Will that make it possible to fetch all different document types grouped for a user?

RoboRobok left a reply on How To Handle Listing Multiple Model Types?

@d9705996 the question is, if I add user_id column to documents table, can I fetch particular type by user? Something like this:

$invoices = User::find(3)->invoices;

The only reason I use polymorphic relation here is to be able to fetch all user's documents. But I will also need to fetch particular document type. Would be great if I could avoid duplicating user_id, which would be the case if I added user_id to both documents and invoices, proofs etc.

RoboRobok left a reply on Are Long Waiting Times A Must Or Bad Development?

@talinon I see. That gives me some perspective.

Also, I had another theory that maybe delayed unsubs are made on purpose to push some more emails to the user and make him remember our company for a little longer ? I doubt it though.

RoboRobok left a reply on Are Long Waiting Times A Must Or Bad Development?

@douglasakula @talinon I think it makes sense absolutely. There is something neurotic in me though, I want my apps to deliver the greatest user experience. I don't understand why would I implement an email queue in the way that's impossible to unsubscribe instantly.

This is technical and a little philosophical topic I would say. I believe there are many guys like me, who want the clients to get perfect user experience. But it's mostly impossible with large projects, where so many people work and perhaps many of them just want to have their job done. Does it make sense?

@ohffs LOL, I'm dead ?

RoboRobok started a new conversation Are Long Waiting Times A Must Or Bad Development?

I have never worked on any large project. I just unsubscribed from one of the old newsletters I've been getting and the message stated: "Your cancellation may take up to 7 days to implement".

I've always wondered why are some systems made this way that it takes them so much time to implement such a simple change. Is this due to having multiple servers and application spread all over them? Or such a heavy load that deleting the record gets very low priority? Or maybe just clumsy architecture?

RoboRobok started a new conversation How To Handle Listing Multiple Model Types?

I have some documents in database. They come in different types, so I have several models representing documents. Now, what if I need to list them all by column, let's say user_id?

My initial database design had each type of the document reside in its own table, like invoices, proofs etc. I also had separate documents table with user_id, document_id and type, using polymorphic relations.

This is a little troublesome though, because I need to use user_id very often for each document type and fetching it through morphing each time is a little much.

How would you guys define this relation?

18 Dec
3 months ago

RoboRobok left a reply on How To Edit Vagrantfile For Homestead?

Unfortunetely it didn't help. Maybe the machine should be restarted?

17 Dec
3 months ago

RoboRobok left a reply on How To Edit Vagrantfile For Homestead?

I'm installing VirtualBox Guest, I've heard it can help too. Nobody experienced 100%+ CPU usage with Homestead recently? The fan is making me crazy, it's works hard all the time.