Ruffles

Fullstack Developer at InterTec

Experience

276,950

161 Best Reply Awards

  • Member Since 2 Years Ago
  • 973 Lessons Completed
  • 157 Favorites

19th July, 2017

Ruffles left a reply on Using ->with() • 1 month ago

One way is to use a Fractal Transformer and customize your own response.

17th July, 2017

Ruffles left a reply on Trying To Get Property Of Non-object • 1 month ago

Look for it in the home.blade.php view file on line 1417 (wow, never seen a view file with that many lines)

11th July, 2017

Ruffles left a reply on Selfmade LengthAwarePaginator Returns Items Not In An Array And Thus They Can't Be Accessed Using Axios.get • 1 month ago

What do you mean by it can't access collections?

you should be able to access your data by response.data in your javascript closure and just use a foreach statement to loop through it to display it on the page.

Another way to fix this problem is to transform the response from the controller.

2nd June, 2017

Ruffles left a reply on Php (Laravel) Developer - Looking For Part-time/full-time Outsourcing Job • 2 months ago

Go on Upwork and apply for the job you like.

25th May, 2017

Ruffles left a reply on CSRF Token In Lumen 5.4 • 2 months ago

24th May, 2017

Ruffles left a reply on Showing The Extract Of An Account • 2 months ago

What are the relationships between the tables?

14th May, 2017

Ruffles left a reply on Manipulate JSON Before Return • 3 months ago

Customize the response the way you want it, example:

return response()->json([
    'data' => [
         'id' => $model->id,
        // .....
    ],
    'meta' => [
        'requiresAuth' => false,
    ]
]);

Ruffles left a reply on CSRF Token In Lumen 5.4 • 3 months ago

JSON Web Tokens is one of the possible options. The JWT Auth package is quite easy to use.

Ruffles left a reply on CSRF Token In Lumen 5.4 • 3 months ago

No, you shouldn't.

Lumen is mainly used for RESTful APIs since Lumen 5.2, so the views functionality was removed.

CSRF tokens are used in a session based traditional application while the RESTful APIs are stateless and do not use sessions.

8th May, 2017

Ruffles left a reply on Learning Suggestion • 3 months ago

Start with Wes Bos' JavaScript 30 tutorials. Also learn JavaScript to a point where you are comfortable to learn the new ES6 / ES2015 features before jumping on the framework train.

Ruffles left a reply on First Time With Laravel And Following Laravel 5.4 From Scratch: User Can't Sign In. • 3 months ago

(the password is in plain text, not hashed.).

There's the problem. Laravel's login function (whichever you use) is comparing hashed passwords and that's why you can't login.

Hash the password with bcrypt($password) and it will probably work.

30th April, 2017

Ruffles left a reply on Any Freelancer Here? • 3 months ago

Sign up on Upwork, set up your profile, find a project you like and apply for it

Ruffles left a reply on 500 Http Error - AJAX • 3 months ago

When I want to pass an ID to the JQuery script, I usually use HTML5 data attributes on the button and just pick up the value in the script.

Example:

// The Blade file
<button type="button" id="button" data-id="{{ $model->id }}"> Button </button>

// The Script
var id = $('#button').data('id');

Most of the time I just hardcode the URL in the script but when I want to make it dynamic, I also use data attributes for the resource name similar to the example above.

Another idea that came to mind just now is that you could pass the whole URL via a data attribute, something like data-url, using Laravel's route() helper.

29th April, 2017

Ruffles left a reply on 500 Http Error - AJAX • 3 months ago

What's the error? Check your Chrome Dev Tools Network tab for more details.

26th April, 2017

Ruffles left a reply on Custom "type" To The Class • 3 months ago

@theUnforgiven Try this:

return redirect('admin/users')
                  ->with('flash', 'Account updated')
                  ->with('flashType', 'success');

21st April, 2017

Ruffles left a reply on How Much Do You Earn? • 3 months 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? • 4 months 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? • 4 months 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 • 4 months ago

By GoDaddy server you mean shared hosting?

9th April, 2017

Ruffles left a reply on I'm Starting To Hate Laravel • 4 months 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? • 4 months 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 months 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 months 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 months 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 months 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? • 4 months 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? • 4 months 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? • 5 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) • 5 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? • 6 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 • 6 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? • 6 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? • 6 months ago

CTRL + F5 (hard refresh) fixed it.

12th February, 2017

Ruffles left a reply on Essential Quals/experience For A PHP Developer? • 6 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? • 6 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? • 6 months ago

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

Ruffles left a reply on Redis In Laravel - Password Protection • 6 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 • 6 months ago

@ohffs How would you deploy Redis in production?

21st January, 2017

Ruffles left a reply on Can't Laracast Be Free? :( • 6 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 • 7 months ago

What about caching?

17th January, 2017

Ruffles left a reply on I'm Starting To Hate Laravel • 7 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 • 7 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 • 7 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 • 7 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 • 7 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 • 7 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 • 7 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 • 7 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 • 7 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?

Edit Your Profile
Update

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