RoboRobok

RoboRobok

Member Since 3 Years Ago

Experience Points 18,280
Experience Level 4

1,720 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 21
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.

08 Feb
1 week 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
3 weeks 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
4 weeks 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
1 month 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
1 month 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
2 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
2 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.

16 Dec
2 months ago

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

That's what I think too, but I still have no idea how to pass these variables. Homestead is not documented too well.

11 Dec
2 months ago
10 Dec
2 months ago

RoboRobok left a reply on Require_if Other Field Contains Some Value

Check out sometimes() method. I'm not sure if it's available for 5.3 though.

RoboRobok left a reply on Very Weird Behavior On Deleting A Model

Why won't you just do it like this?

$user->comments()->delete()

It will be faster, because it creates one database query per model type. Your way makes n queries, where n is the number of entities.

RoboRobok left a reply on Connect Website To Other Database Server

Just set the appropriate database host.

RoboRobok left a reply on Sort By Default On Name ASC Using Kyslik\ColumnSortable\Sortable

The documentation clearly says how to do it:

You can set default sorting parameters which will be applied when URL is empty.

$users = $user->sortable('name')->paginate(10);
// produces ->orderBy('users.name', 'asc')

$users = $user->sortable(['name'])->paginate(10); 
// produces ->orderBy('users.name', 'asc')

$users = $user->sortable(['name' => 'desc'])->paginate(10);
// produces ->orderBy('users.name', 'desc')

RoboRobok left a reply on Why Is Telescope Service Provider Auto-discovered?

I think this is not possible. Auto discovery is there since Laravel 5.5 and Telescope requires Laravel 5.7.7. I thought it’s some caching thing or just a forgotten thing. Maybe they decided later to add service provider manually (to make it easy to have local-only Telescope) and forgot to change the legacy code?

RoboRobok left a reply on HTML5 Validation Multiple Forms

The reasons are not enough to use multiple forms, it’s almost never a good aproach to use multiple forms doing the same thing. The design problem is not a real problem :) You can still achieve the same layout using single form.

RoboRobok left a reply on HTML5 Validation Multiple Forms

I have a feeling that your code needs a redesign.

RoboRobok left a reply on HTML5 Validation Multiple Forms

Why are they separate forms?

RoboRobok left a reply on HTML5 Validation Multiple Forms

@andreich1980 is correct. That's the first problem here.

Are you validating just the first form and then clicking button on every form, depending whether the first form is valid or not?

RoboRobok started a new conversation Why Is Telescope Service Provider Auto-discovered?

In Laravel Telescope, its main Service Provider is being auto-discovered:

"extra": {
    // ...
    "laravel": {
        "providers": [
            "Laravel\Telescope\TelescopeServiceProvider"
        ]
    }
},

I don't really get it why, because the installing script (php artisan telescope:install) adds the child service provider to the config/app.php:

file_put_contents(config_path('app.php'), str_replace(
    "{$namespace}\Providers\EventServiceProvider::class,".PHP_EOL,
    "{$namespace}\Providers\EventServiceProvider::class,".PHP_EOL."        {$namespace}\Providers\TelescopeServiceProvider::class,".PHP_EOL,
    $appConfig
));

This child service provider extends the auto-discovered one:

use Laravel\Telescope\TelescopeApplicationServiceProvider;

class TelescopeServiceProvider extends TelescopeApplicationServiceProvider

My question is, what is the point of auto-discovering the parent service provider if we are manually registering its child anyway?

RoboRobok started a new conversation How To Edit Vagrantfile For Homestead?

Hi guys, I'm getting 100% CPU usage from VBoxHeadless process. After some research, it turns out this setting in Vagrantfile should help:

$enable_serial_logging = false

How do I change this in Homestead? Should I put it to Vagrantfile or Homestead.yaml? And which lines exactly?

07 Dec
2 months ago

RoboRobok left a reply on Can I Use Eloquent's Count() With GroupBy()?

@petrit This is not the same thing. Like @talinon said, if you have many records, it will be very slow.

RoboRobok started a new conversation Can I Use Eloquent's Count() With GroupBy()?

I would like to count games by is_released flag. I did it like that:

Game::select('is_released', DB::raw('count(*)'))
    ->groupBy('is_released')
    ->pluck('count(*)', 'is_released');

Another way to express the same thing is:

Game::select('is_released')
    ->selectRaw('count(*)')
    ->groupBy('is_released')
    ->pluck('count(*)', 'is_released')

It works, but can it be simplified, using Eloquent's count() method instead of DB::raw() or selectRaw()? (I'm just curious)

27 Nov
2 months ago

RoboRobok left a reply on Set Vue Component As 'default'

Just go through Vue.js basics, I don't see why would anyone repeat after tutorials. The answer to your question should be in the first paragraph of any tutorial.

RoboRobok left a reply on Laravel New Files Missing Index.html, Index.php, And .htaccess

The root of Laravel app is in /public folder, so some other things like /config, /storage, /vendor etc. are higher in the directory tree than your index.php. Your domain should be pointing at the /public folder. /public/index.php is where it all starts :)