20 Best Reply Awards

  • Member Since 3 Years Ago
  • 1220 Lessons Completed
  • 10 Favorites

5th May, 2017

HRcc left a reply on Ideas To Store Record Activity Logs? • 11 months ago

Generally, storing logs in the main DB is completely fine. However, if you need to build some complex analytics on top of that or the record count is huge, there might be better solutions available (InfluxDB, Cassandra, Couchbase,...).

13th April, 2017

HRcc left a reply on Class 'Tests\Unit\Mockery' Not Found • 1 year ago

You have to namespace it properly \Mockery.

15th March, 2017

HRcc left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 1 year ago

@jlrdw Why would you think that recommending Vue confuses newcomers? If they can't open Vue docs or Vuecasts to understand the goals of Vue, they have much bigger problem than being new to the dev world/framework. The same applies to Bootstrap or Eloquent. It shouldn't matter if some of them think that it's 100% required. It just means, they should learn more and understand the technologies separately, before trying to combine them.

I honestly think that having a recommendation is much better for newcomers than doing research about React, Angular, Ember, Vue, Aurelia, ... if you just want that damn form to be posted asynchronously.

If you've used Laravel for a while and had a need for it, it literally takes 2 minutes to swap Vue with React and Bootstrap with Bulma.

I've been working with Laravel since version ~3, and I can't remember a feature that I didn't like even if I had no use for it at the time of each new release. But for whatever reason, lately, people have been going crazy about how open-source frameworks keep adding/improving features, and these are forced upon us -- poor developers. Guys like Taylor, Evan, TJ and many others are working on this free stuff incredibly hard, yet not many people seem to appreciate it.

It's like Jeffrey wants you to use command bus with Vue for the landing page because you've been a naughty boy. It's all just tools and recommendations. Pick those you like and feel right for the job and have the rest in the back of your head if you need them later. Why can't this message, which Jeffrey mentions in most of the videos, seems never to be heard?

14th March, 2017

HRcc left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 1 year ago

Woah, this thread blows my mind. Anyways, here is something for you:

Matt handles the immense task of removing Vue like a pro.

6th October, 2016

HRcc left a reply on About Vue 2.0 • 1 year ago

I've converted two larger apps to Vue 2.0 in the past week and the updated codebase just looks so much cleaner, especially when it comes to Vuex and Vue-router related stuff. Although I liked filters, sync, dispatch&broadcast, it didn't take too much effort to get used to the new Vue 2.0 way of doing things.

5th October, 2016

HRcc left a reply on Dry Crud Controller! • 1 year ago

From my experience, you can create an abstract "god" controller which handles validation, storing, responses and it works in specific cases. However, I rarely find it useful and prefer readability much more. In addition, it generally tends to get really messy when you need to add filtering, queued jobs, route model binding, selective caching and all that good stuff you often use.

8th August, 2016

HRcc left a reply on Good Example Of Using Command Pipeline? • 1 year ago

I've recently used it for Eloquent query filtering/sorting - each stage of pipeline checks presence of some value on the request and adjusts the query builder accordingly. It's quite pleasant to work with, since you can test the stages independently or easily add/remove them.

Another usecase I had was very similar. I needed to do some extra logic after PATCH request and I used this pipeline structure to pass an empty array with the request through multiple stages which built my array of updates used in $model->update($updates).

27th June, 2016

HRcc left a reply on Whats The Best Role/Permission System For Laravel 5.1/5.2 • 1 year ago

You can have a look at laravel-permission. Lately, I've been using multiple of Spatie's packages and they are very pleasant to work with.

8th June, 2016

HRcc left a reply on Mailgun & Vue? • 1 year ago

If the packages don't work, there might be some inconsistence with the Mailgun's API, however you should always be able to use their API directly. Just build a wrapper class around your HTTP client (probably vue-resource) and you will get a nice interface in no time.

19th May, 2016

HRcc left a reply on Anyone Using Laravel Echo? • 1 year ago

Haven't tried Echo yet, but Pusher needs you to handle auth in your API. Once you do that, you should be good.

15th March, 2016

HRcc left a reply on Authentication In Lumen • 2 years ago

Have look at JWT

6th March, 2016

4th March, 2016

HRcc left a reply on Spark Will Not Be Free • 2 years ago

@i960 Then maybe find a partner with an idea (might not be a developer at all) and you can build the product together.

29th February, 2016

HRcc left a reply on Using In Production Environment With Laravel Projects • 2 years ago

You can use laravel-cors to fix that error.

28th February, 2016

HRcc left a reply on Webpack, What Is It? • 2 years ago

You will never be able to truly master everything™. It's more important to know different approaches so that you are able to pick the right(ish) one for the problem you're dealing with. You can always focus on specifics when you need it.

HRcc left a reply on Webpack, What Is It? • 2 years ago

It's similar to Browserify -> (not only) Javascript bundler. It seems to be favoured in some communities (Vue, React,...) because of cool dev features like hot loading and lazy loading. It's definitely worth learning.

20th February, 2016

HRcc left a reply on Calculate Age From Date Stored In Database In Y-m-d • 2 years ago

You should be able to use Carbon's diffInYears to calculate age easily. Similarly, use Carbon to reformat the date for view. The logic could be placed in model directly (maybe as age getter) or presenter. I would avoid putting this to controller.

17th January, 2016

HRcc left a reply on Is There A Way I Can Support Both Guzzle 5 And 6 In My Laravel Package? • 2 years ago

I see that you have a HttpClientInterface which is implemented in your adapter. It shouldn't be difficult to write another implementation for Guzzle 6 and let users decide which one they want to use in the HttpClient trait. Moreover, when it comes to Laravel, you can provide config allowing for easy http client selection (and you would just bind the chosen implementation in the service provider directly)

6th January, 2016

HRcc left a reply on Lumen Or Laravel? • 2 years ago

Just go with Laravel. Lumen is cool, but you probably don't want to build your whole app around it unless it's an API.

HRcc left a reply on Looking For Potential Book Reviewers • 2 years ago

I'd be happy to review that. Really like the idea of those illustrations :)

HRcc left a reply on What Is The Difference Between Integration Test & Acceptance Test • 2 years ago

Generally I'd call integration test anything which combines multiple 'units' of code. And acceptance tests are those, coming from the outside in, written in a way of user directly executing the steps and observing the results.

For example with that registration example of yours: You might have some form of RegistrationService, RegisterUserCommand or something similar, which takes input from the request and does multiple steps to register the user. You could test that if you provide correct input to this registration class, the user will be created in the database, they will be sent a welcome email, a new customer account will be created with stripe and you will get notification on slack. In this case you are interested in knowing if all these registration steps were successful, not how they were executed in detail.

Acceptance test on the other hand could look like an user is registering on your page in his browser. He fills in the registration form, hits the submit button, sees the registration success message and receives the welcome email.

2nd January, 2016

HRcc left a reply on Laravel Anbu Profiler • 2 years ago

I guess that this profiler is no longer maintained (last commit from Sep 2014). Laravel-Debugbar has always been the way to go for me.

10th December, 2015

HRcc left a reply on Nested Components • 2 years ago

Sure, there's nothing wrong with that, however remember, that you should get the message into the alert somehow (either using props or transclusion). Moreover you would probably want to register a global component for alert (and not subcomponent for contact-form) since you'll probably use it elsewhere as well.

7th November, 2015

HRcc left a reply on Async Requests With Authentication • 2 years ago

You can use JWT or other token auth solutions. This way you will send credentials only once and use token with each request instead.

25th October, 2015

HRcc left a reply on L5.2 Block User From Editing Another User • 2 years ago

You don't need the else block at all + have a look at ACL series

16th October, 2015

HRcc left a reply on Start Values For Migrations • 2 years ago

Why don't you use seeders?

12th October, 2015

HRcc left a reply on Lost In Testing • 2 years ago

Yes, I would do it that way. Maybe you can get away with VM, spinning up a low cost virtual server or using your other personal server for this. It depends on your needs and character of your app.

11th October, 2015

HRcc left a reply on L5.1: How To Share A Collection In All Views? • 2 years ago

... or View Composers if you keep that in a sidebar or footer partial.

10th October, 2015

HRcc left a reply on Lost In Testing • 2 years ago

Don't try to unit test your controllers or models. You can use integration approach for those.

  1. Given that you have a server, you should be able to grab server info and verify, that it really is the info of the correct server.
  2. When I call this reboot method and the server is running, it should maybe start to shut down some services and then reboot.

The implementation depends on your requirements and app logic, however these tests are more useful for controllers and models, since they mimic the real world behaviour much closer that mocked tests.

HRcc left a reply on Why Laravel 5.1 Don't Have Bootstrap Included • 2 years ago

NPM / Bower / download it from the website and throw files into public folder...

HRcc left a reply on CSRF With API • 2 years ago

You don't need to. Exclude your API from CSRF checks. If you are using JWT or OAuth, you're not dealing with cookies, which makes CSRF protection not necessary.

1st October, 2015

HRcc left a reply on Entities Tightly Coupled With Eloquent • 2 years ago

I'd recommend that you either embrace Eloquent (Active Record) or replace it with something else (Data Mapper/...). Regarding testability, I've written tons of tests for complex Eloquent models interaction and it never bothered me in the slightest. Moreover it gives you a nice way to test your API - naming/returned objects/...

Although Eloquent can feel kinda dirty, if you try to follow some 'recommendations', it is not and it truly is a quick and natural way of interaction with DB.

24th September, 2015

HRcc left a reply on How Can We Create Frontend And Backend Login ?? • 2 years ago

I generally prefer to build admin part separately. You can always share models/services using custom packages, but using this approach you can focus on each part to do what it's supposed to do. Moreover broken commit related to reporting won't kill your landing page etc.

14th September, 2015

HRcc left a reply on Form Request Like Uploading • 2 years ago

This really looks like a neat solution :) Generally I tend to use queued jobs for this task, since there is often some additional processing or S3 upload involved. However firing an event at the end of upload method could solve this.

12th September, 2015

HRcc left a reply on Laravel 5.1 ACL Help • 2 years ago

@xtremer360 check 18:08

11th September, 2015

HRcc left a reply on Laravel 5.1.11 Brings Us Authorization! (User Permissions / Access Control) • 2 years ago

@kocoten1992 I solved this exact thing today... by uninstalling Entrust :) The switch was very quick and painless.

HRcc left a reply on Question: SPA Structure. Starting With Angular With Laravel • 2 years ago

Firstly, if you want to build SPA with Angular + Laravel, then your best bet is to build them independently. Use Laravel to form the API and consume the API with your Angular app. This way you can switch Angular at any point or use native mobile apps as another mean of consuming your API.

As for CSRF, remove the CSRF middleware and you're good. Otherwise you'll have to serve your Angular from a Laravel view to get that CSRF token, send it with each request,...

Just use JWT (have a look at (satellizer)[]) and you don't have to bother with CSRF, mobile issues or sessions.

HRcc left a reply on Laravel Policies With Cartalyst Sentinel • 2 years ago

Since it works for you, it's good. However, you could create custom Gate implementation which plays nicely with Sentinel and swap it with the original. I'd consider that a cleaner solution instead of using two auth systems at the same time.

4th September, 2015

HRcc left a reply on Laravel Spark • 2 years ago

@MattCroft Frontend should be enhanced by Vue if I remember correctly, although many views are probably just basic Laravel views.

Regarding configuration, I believe that you expect too much. It should help you to start quickly without the need to build the stuff included, but everything else is for you to create. If you don't want to deploy after adding subscription, then create an admin layer around it and manage it there. There is no way that Taylor would be able to implement all specific implementations, that people might want, he basically provides an interface to work with Spark = wrapper around 'core' parts of SAAS.

30th August, 2015

27th August, 2015

HRcc left a reply on Project Scale • 2 years ago

You can always create custom packages for search/payments/dashboard/... and pull them through composer (pointing to private or public repository) into all those application, where they're needed. This way you can avoid code duplication quite efficiently.

10th August, 2015

HRcc left a reply on Returning Data From A Job? • 2 years ago

Self handling job uses constructor to assign properties and handle method to do the stuff. You just want to return data from handle method if I'm not mistaken. Why would you then bother with command bus and command pattern, since basically you just need a simple class "looking" as a job/command, which does exactly that. Moreover, you can turn it around and request dependencies in constructor and pass parameters to handle (or whatever method) to process it.

This will get you this:

public function store(Request $request, PostMessage $postMessageCommand)
     if (!$this->messageValidator->isValid($request->all())) {
          return redirect()->back()->withInput()->withErrors($this->messageValidator->getErrors());

      $input = $request;
      $input['user'] = Auth::user();

      $messageId = $postMessageCommand->handle($input);

      return redirect('messages');

You will have your logic in one class as requested and you can create multiple classes like this, or join them together to MessagingService or something similar.

6th August, 2015

HRcc left a reply on Speaking Of Pushing To Clients: New Lesson Notifications? • 2 years ago

Or how about slack notifications? :)

29th July, 2015

HRcc left a reply on Encrypting Model Data • 2 years ago

Eh, my bad, switched it for the correct example. Thanks for pointing that out.

HRcc left a reply on Encrypting Model Data • 2 years ago

@ShaunL No, it won't be the same, since there is a presence of randomized instruction vector in the Encrypter class. You can easily test that in tinker calling bcrypt('secret stuff') twice or more times.

24th July, 2015

HRcc started a new conversation Real-time Threads View • 2 years ago

Sometimes I don't close tabs with specific threads, because I'm waiting for a response or just another entry. The way it works now is that you receive the notification about the newly added post, then you have to reload the page yourself to view it. How about utilizing this push message in the way, that it would run AJAX request to grab the new post and append it to the list (maybe with a label showing that it's new).

It would definitely be a good topic for a video as well :)

What do you think about it, @JeffreyWay ?

HRcc left a reply on Change Laracasts Colour Back To Laravel Colour • 2 years ago

I had to turn off my f.lux to check if it was real :)

But to be honest, I'm not a big fan of this change. Maybe I'm just old fashioned, but red submit button feels wrong. Although I really like the red color, the amount of it feels too much. It looks like there are some sort of errors around the page and the the red text itself is a bit too dark on both white and dark backgrounds.

HRcc left a reply on Can't Laracast Be Free? :( • 2 years ago

I guess that the point is, that products in our industry are mostly immaterial assets. That leads to situations when some people think that there is no "real" value behind it, compared to bread, book, table, car,... If anybody asks for a free car, you'll consider him a fool, but asking for a free screencasts is no different in my mind. Some people make them for free, which is great, but the quality may vary. Here you are paying $9/month for high quality screencasts which help you solve most of the problems you'll have to deal with. It's basically free for the value it provides since I'm sure that you would spend much more time browsing SO or google to get the information provided in any short video here - Laracasts really pay for itself.

(... and I come from a country, where the average hourly wage is around $3-4 with the price of coffee around $2)

21st July, 2015

HRcc left a reply on $fractal Versus Protected $casts() • 2 years ago

Sure, there is a lot of stuff fractal offers you - data includes, powerful pagination, easy edits of your column names without changes in your api,...

But if you only need casting, you probably don't need fractal at all.

15th July, 2015

HRcc left a reply on Why Use Service Providers? Any Examples? • 2 years ago

@pmall thanks, in my mind I've been writing about those more complex constructors, singletons, decorators,... where it is useful. Maybe I was not clear enough.

Edit Your Profile

Want to change your profile photo? We pull from