Ruffles

Fullstack Developer at InterTec

Experience

263,940

155 Best Reply Awards

  • Member Since 2 Years Ago
  • 885 Lessons Completed
  • 124 Favorites

21st April, 2017

Ruffles left a reply on How Much Do You Earn? • 4 days ago

@fahaddsheikh I don't think that our profession (web development) is underpaid, it's just that it depends on the company and client you work for, and the complexity of the projects you work on.

If all you do is work on some projects which are simple CMSes / agency or company blogs and websites, you'll probably be paid less, because the responsibility is lower.

If you work on a bigger project, like an ERP / CRM, you would probably be paid higher because the responsibility is higher.

And to answer your question:

I didn't say that you shouldn't look for a better job position / salary, I was trying to say that it won't make much difference if you start comparing your salary with other people's salaries, because it heavily depends on the company they work for, the client they work for, the country they live in and many other things.

You just have to find the right company for you, because everyone has a different idea of what's their ideal job position.

Some people are just interested in the idea of having a job and that they can say that they work for a company and never go up the ladder or advance in their career. On the other hand, some other people care more about the organization, type of projects, how the projects are organized type of thing and can't just work for anyone and anything like me.

Get to a position where you can choose what you want and how you want, and you won't have a problem finding an amazing company.

17th April, 2017

Ruffles left a reply on How Much Do You Earn? • 1 week ago

It does not matter how much you earn, as long as you can cover the living expenses.

16th April, 2017

Ruffles left a reply on Anyone Try The Micro Framework Equip? • 1 week ago

I have not yet run into any problems with Lumen and PHP 7.1 so I guess it's supported.

14th April, 2017

Ruffles left a reply on Laravel Project On The Server Of Godaddy • 1 week ago

By GoDaddy server you mean shared hosting?

9th April, 2017

Ruffles left a reply on I'm Starting To Hate Laravel • 2 weeks ago

@endian Most of the features Laravel offers are used in bigger-than-just-a-blog projects at some point of the project's development cycle. If you work on an ERP / CRM app for a while, you'll notice that.

The only reason I am using a framework is because I wanna finish the project on time before the deadline hits. I could build everything from scratch but it will take a lot of time and effort. I might get stuck at some point but the client won't be like "Good job man, you are a serious developer. You are not using a framework".

All clients care about is a working project, they don't really care about the technical stuff. It's up to the developers to make their life easier.

31st March, 2017

Ruffles left a reply on Does Eloquent Prepare The Output Of The Data In The Collection When Relationships Are Eager Loaded? • 3 weeks ago

I went with a different route, using group_concat and group_by, a little bit different than @jimmck 's example. Now I am getting them as strings which can be easily used in the future.

Thank you all for your contribution in this discussion!

28th March, 2017

Ruffles left a reply on JQuery Is Not Initialized When Using Laravel Mix 0.9.* • 4 weeks ago

The docs on Laravel Mix Autoloading say that it will add it to every file JQuery is required.

Ruffles started a new conversation JQuery Is Not Initialized When Using Laravel Mix 0.9.* • 4 weeks ago

Hello!

I just upgraded Laravel Mix to version 0.9 and I noticed that my template stopped working because JQuery is not being initialized before Bootstrap.

The error I am getting is the following:

Uncaught Error: Bootstrap's JavaScript requires jQuery

So I searched google and saw that the default autoloading for JQuery was removed. I tried to add it back with

mix.autoload({
   jquery: ['$', 'window.jQuery']
});

but that didn't help me, I still have the same problem.

How can I include JQuery to the webpack.config.js file manually?

Ruffles left a reply on Does Eloquent Prepare The Output Of The Data In The Collection When Relationships Are Eager Loaded? • 4 weeks ago

I have managed to figure out a way to group the output in a way Eloquent does it, using arrays and standard classes like in my example. The only problem I have now is the pagination is not consistent. Different number of results are displayed depending on the roles assigned to the users.

For example: If all users have all 4 roles (will probably never happen, they might have 3 of those 4 roles in some cases.) and I have 30 records per page set, I will get only 9 records back. If I increase the number of records per page to 200, I will have 52 users returned. This is happening because the pagination is ran against the role_user table and with the output grouping (or transformation), I cut down the array of items down.

26th March, 2017

Ruffles left a reply on Does Eloquent Prepare The Output Of The Data In The Collection When Relationships Are Eager Loaded? • 4 weeks ago

The desired output would be:

stdClass => 
   'email' => [email protected]',
    // some other fields go here
   'roles' => [
      stdClass => [
          'name' => 'super_admin'
      ],
       stdClass => [
          'name' => 'client_manager'
      ]
   ]

this is how eloquent outputs the query but for some reason I get the following when I use the fluent query builder with joins:

[
    stdClass => [
       'email' => [email protected]',
        // some other fields go here
       'role_name' => 'super_admin'
    ],
    stdClass => [
       'email' => [email protected]',
        // some other fields go here
       'role_name' => 'client_manager'
    ],
]

Ruffles left a reply on Does Eloquent Prepare The Output Of The Data In The Collection When Relationships Are Eager Loaded? • 1 month ago

My table schema is simple:

users table

id
email
password
...

roles table

id
name

role_user table

role_id
user_id

I am using the same schema from the package spatie/laravel-permission

25th March, 2017

Ruffles started a new conversation Does Eloquent Prepare The Output Of The Data In The Collection When Relationships Are Eager Loaded? • 1 month ago

Hello there!

I am working on this project where I use the Fluent Query Builder and I am trying to recreate the same output from the eloquent relationship eager loading, User::with('roles')->get() for example, with join statements.

As a result I had duplicate rows for obvious reasons. I had a list of repeating email addresses with multiple role names for a many to many relationship.

My question is: Do I have to manually structure the objects where I have a nested object(s) for the relationships?

25th February, 2017

Ruffles left a reply on How Can I Access Children Data From The Parent In VueJS2? • 2 months ago

To pass data from a parent component to a child component, use props. To pass data from a child component to a parent component use custom events.

Ruffles left a reply on "Real World" Example Of CRUD W/ Laravel & Vue (non SPA) • 2 months ago

Build components and use props to pass jsonified data (json_encode($projects)) to the component.

Example:

<projects-list :projects="{{ json_encode($projects) }}"></projects-list>

20th February, 2017

Ruffles left a reply on When Starting A New Project With Multiple Components Like Website, Admin Panel, API, Subscriber Panel Etc. How Do You Structure It? • 2 months ago

Building the project as packages might be useful but it has downsides like the need to update all packages every time you add new code in one of the packages.

19th February, 2017

Ruffles left a reply on Repository Pattern • 2 months ago

As far as I know, there's form (request) validation for that, but I am not sure if model validation is needed (maybe in some cases) before each database write operation.

17th February, 2017

Ruffles started a new conversation When Starting A New Project With Multiple Components Like Website, Admin Panel, API, Subscriber Panel Etc. How Do You Structure It? • 2 months ago

Hey there,

I am starting a new project and I am wondering if thinking about scalability is a good idea at the beginning when I have no idea about any stats.

So my question is:

When starting a new project which has multiple components like Website, Admin panel, Subscriber panel, API, iOS app, Android app and maybe a few more, do you:

  • Build them all as one Laravel application
  • Build an API in Laravel / Lumen and use front end frameworks like VueJS / Angular / AngularJS / React
  • Build each component in a different Laravel application, so you end up with like 4, 5 or maybe more Laravel applications which most of them will share the same features and / or models

15th February, 2017

Ruffles left a reply on Did I Lose My Search Privilege? • 2 months ago

CTRL + F5 (hard refresh) fixed it.

12th February, 2017

Ruffles left a reply on Essential Quals/experience For A PHP Developer? • 2 months ago

I would say that motivation and drive to learn and get better every single day is the most important skill you can have.

I would say that Laracasts is probably your best resource for Laravel which helped me to find a job and help colleagues. Oh and it's an amazing feeling when I can mention watching Laracasts videos on my LinkedIn profile as experience and colleagues at my first company say stuff like "Are you Ruffles from the Laracasts forums?!" :D Thanks @JeffreyWay

I learn mostly from video tutorials so I am subscribed to some other popular web development video tutorial platforms besides Laracasts.

I've also bought a few useful PHP / Laravel courses which I've learned a lot from (haven't touched Adam Wathan's book Refactoring to Collections and his course Test Driven Laravel yet).

I also watch conference talks to get some tips and tricks, help people on these forums here from time to time and I have a few books that I want to read but I have not found any free time to focus on them. Newsletters are piling up in my email and I read some of them.

Before I forget, I also learn a lot from working on real projects where I have to implement different features for clients. It taught me how to figure out stuff on the spot, by reading docs, googling and asking people on forums or the Larachat slack channel.

Maybe the Awesome Laravel list will help you find some resources.

Attending Laracon is not a bad idea, if you have the money and time to attend it. Laracon Online will be interesting.

I don't see much value in certificates really, because the technology is moving so fast and they might be useless after a while. Adopting a new technology quickly is more important than a certificate if you ask me.

25th January, 2017

Ruffles left a reply on Override Default Email For Password Resets In 5.4? • 3 months ago

You have to publish the vendor email template files by running php artisan vendor:publish --tags="mail"

Ruffles left a reply on Class 'App\Console\Carbon' Not Found? • 3 months ago

Add use Carbon\Carbon; at the top of the console command class.

Ruffles left a reply on Redis In Laravel - Password Protection • 3 months ago

Any ideas if I use Redis on AWS or any other hosting (except shared hosting)?

24th January, 2017

Ruffles left a reply on Redis In Laravel - Password Protection • 3 months ago

@ohffs How would you deploy Redis in production?

21st January, 2017

Ruffles left a reply on Can't Laracast Be Free? :( • 3 months ago

Maybe if Jeffrey implements a "Donate a subscription for a person who wants to level up", it would be cool.

18th January, 2017

Ruffles left a reply on Bug On Laracasts • 3 months ago

What about caching?

17th January, 2017

Ruffles left a reply on I'm Starting To Hate Laravel • 3 months ago

Wow, sorry man, that sucks. It can be frustrating sometimes when you don't know how to find the solution but the tool is not really the problem most of the times.

I remember having to build a real-time chat and it took me about 4 months to finish a basic functionality, but I realized that the idea I was going about it was bad, not the tools I use. At one point I was completely stuck and didn't know what to do next, but I found a solution thanks to the community.

Calm down and try again. Feel free to ask people either here on the forums or the Larachat slack community.

5th January, 2017

Ruffles left a reply on Laracasts AutoSubscription • 3 months ago

You haven't really understood the word subscription.

When you signed up to Laracasts, didn't you read the plan names? It clearly states monthly and yearly and that means that you will pay every month for the service to be able to watch the videos.

The subscription model is not a one-time thing and you are done. You have to cancel the subscription right after you pay for the month in order for you to stop the payment process next month / year. You'll still have access to the videos for that month but you won't be billed next time.

Only the forever plan is a one-time payment and you will have access to all of the videos forever.

If you are not happy and want to ask for a refund, send Jeffrey a support message by clicking on the support link in the footer of the page.

Ruffles left a reply on Remove Public From URL Api Lumen • 3 months ago

No. that's the PHP server and it's only used in development.

4th January, 2017

Ruffles left a reply on Remove Public From URL Api Lumen • 3 months ago

Laravel / Lumen and shared hosting are not exactly best friends. For Laravel / Lumen apps, you need to be able to have full SSH access and complete folder structure control, also known as your own server.

Last time I tried to add a Laravel project on shared hosting, it ended up being way too limited and I was able to add the project files in the public_html folder which ruined the URL paths.

Some shared hostings might allow full SSH access and folder access, but you have to check that in the features they offer.

30th December, 2016

Ruffles left a reply on Throttling / Spacing Out Jobs • 3 months ago

The first thing that comes to mind is to add a separate queue listener specifically for the queue that processes the requests and after each job is processed, restart the queue listener and add a different delay (the --delay option) on each restart.

I know it's not the smartest idea but it might work temporarily. Can't think of any other way to set a different delay in runtime.

Personally, I haven't tried it but I know that when the queue listener stops working, you restart it and the job that is next in the queue will jump on try 2 (if it stopped on try 1 for example) and will be reprocessed again.

I've noticed this when I had a problem with the queue listener docker container in development. It suddenly stopped working for some reason, so I had to restart it completely.

29th December, 2016

Ruffles left a reply on /logout Does Not Exists • 3 months ago

It's in the Illuminate/Routing/Router class, the auth() method.

27th December, 2016

Ruffles left a reply on Return Response From Controller Based On A User's Role Laravel 5.3 • 3 months ago

$users = auth()->user()->hasRole('admin') ? getAllUsers() : getUsersForThatOrganization();

return view ('users.index', compact('users'));

This code assumes that only admin and organization_admin roles have access to the users route.

Ruffles left a reply on Creating A Laravel Web Client From An Internal Laravel API • 3 months ago

You have a few options:

  1. Build the API and the mobile and web clients will use it fully (the front end will be some kind of single page application). [Recommended]
  2. Build a traditional web client which won't use the API at all but it will use/share almost all of the features that the API has. (Same or differe
  3. Use 2 different projects for the API and the web client and run requests from the web client to the API using Guzzle or something similar. (this will count as external API) [Not Recommended]

I recommend the first approach because you are already building an API, so why not use it fully for all clients? It might require a little bit extra JavaScript knowledge and understanding of the front end world, but you won't need to reimplement the same features twice.

Ruffles left a reply on How Type Hinting Works? / Type Hinting With Own Class • 3 months ago

You are missing a $shipment_id variable as a parameter in your show() controller method.

You have to pass that shipment ID to the class somehow, maybe through a named constructor?

Ruffles left a reply on Vue Js Or React Js For Laravel • 3 months ago

When choosing a framework or technology for a project, research the following things:

  • How big is the community and can I find people to help me when I am stuck?
  • Are there any learning resources?
  • Will it be easy for me and my team to work with it?
  • Maybe a few more similar questions

Laravel can work with any framework, but it's up to you to choose which one you should work with, because at the end of the day, you will work on that project, we won't.

25th December, 2016

Ruffles left a reply on New To Laravel - Is This The Right Approach For Learning Laravel & Side Project Goal? • 4 months ago

I'd suggest to you to start with the following list:

Jeffrey will record a new Laravel 5 from scratch series when Laravel 5.4 comes out (most likely next month) so you will have to check the documentation about some things while following some of the examples.

Remember to rewatch some of these videos to understand the concepts better.

After you are done with this list of series, you can start looking at individual features of the framework in the What's new in 5.* or Intermediate Laravel.

Have fun!

22nd December, 2016

Ruffles left a reply on Laravel 5.3 - How Do I Delete Rows Depending On The Selected Checkbox? • 4 months ago

Send the selected IDs as an array to the server using <input name="dosier_ids[]"> and on the server, just do something like Dosier::whereIn('id', request()->get('dosier_ids'))->get()->delete();

21st December, 2016

Ruffles left a reply on Laracasts Subscription Bug • 4 months ago

Click on the Support link in the footer of the page and send a message to Jeffrey about your story.

Ruffles left a reply on Laravel 5.3 With AngularJS 2.0 • 4 months ago

  1. Create a new Laravel project,
  2. Build the API
  • Setup CORS (if you host the apps on different domains)
  1. Create an Angular 2 project and set it up.
  2. Build the front end
  3. Host the apps on a server somewhere.

19th December, 2016

Ruffles started a new conversation How Can I Increase The Session Lifetime For Unauthenticated Users (guests) When They Browse A Website? • 4 months ago

Hello!

I am looking for a way to increase the lifetime of the session based on the clause if the user is authenticated or not. I am keeping some data in the session for tracking purposes and I want it to be longer than 2 hours.

I know about the session_lifetime option in the config files but that won't help because in this case, that number should be dynamic.

Any ideas how can I do that dynamically in runtime?

18th December, 2016

Ruffles left a reply on Deleting A Migration • 4 months ago

You can delete the file and the record with the same filename from the migrations table and it should not cause any troubles.

Ruffles left a reply on Api Attributes • 4 months ago

It's not bad but it might cause bugs in some cases.

Read this article for more information

Ruffles left a reply on Api Attributes • 4 months ago

I'd go with transformer classes using Fractal, and modify the response of the model in a way that I can add data which the model itself does not have.

16th December, 2016

Ruffles left a reply on Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 4 months ago

That means, the $user variable is empty and you are not reassigning it if it's null so just reassign it to the User::create() part and it should work.

14th December, 2016

Ruffles left a reply on Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 4 months ago

Add it before the try catch block.

13th December, 2016

Ruffles left a reply on Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 4 months ago

yup, before getting the user() data.

Ruffles left a reply on Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 4 months ago

Yeah, I didn't check the request at all to see what's returned but someone on Larachat helped me solve this problem.

All I had to do before getting the user and handle the request was to add the following code in the callback method:

if (!$request->has('code') || $request->has('denied')) {
    return redirect('/');
}

12th December, 2016

Ruffles started a new conversation Laravel Socialite Throws A Fatal Error When I Cancel The Authorization Process With Facebook • 4 months ago

Hey,

I am trying to implement Facebook authentication with Laravel Socialite and I've mostly done all of it, but now I have a problem when the user cancels the authorization process on the facebook page.

The problem is, when I click on the "Cancel" / "Not Now" button, I am redirected back to my facebook callback route and I get the following error:

GuzzleHttp \ Exception \ ClientException (400)
Client error: `POST https://graph.facebook.com/oauth/access_token` resulted in a `400 Bad Request` response: {"error":{"message":"Missing authorization code","type":"OAuthException","code":1,"fbtrace_id":"AkLoGvbv7tn"}}

Any ideas what could be the problem or how to deal with it?

Ruffles left a reply on How To Change The General Uncaught Exception JSON Response? • 4 months ago

I am still looking for a way to override the uncaught exception JSON responses based on our team's rules. If I don't do that, the mobile apps will break because of their error handling patterns.

From the uncaught fatal exception JSON response example in the opening post, I want to change it to something like:

{
    "status_code": 500
    "status": "error",
    "message" => "An error has occurred and this resource cannot be displayed."
}

Also, I forgot to mention that I am using graham-campbell/exceptions

Any ideas how can I do that?

10th December, 2016

Ruffles left a reply on How To Define Constants In LUMEN • 4 months ago

Create a class (maybe a model) and put the roles there.

Example:

Role.php

class Role 
{
    const ADMIN = 1;
    const MEMBER = 2;
    const SUBSCRIBER = 3;

    public function someMethod(){}

}

You can use these constants in your controller like so:

class SomeController extends Controller 
{
    public function someMethod() 
    {
    // some example query to demonstrate how to use the constants from the Role class.
         $admins = User::roles()->where('role', Role::ADMIN)->get();
    }
}

Don't forget to import the Role class at the top of the controller file with the use statement.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.