6 Best Reply Awards

  • Member Since 6 Months Ago
  • 173 Lessons Completed
  • 0 Favorites

19th October, 2017

Thyrosis left a reply on Should I Stick With Resource Controller? • 11 hours ago

@topvillas, don't you get an abundance in controllers then?

For instance, I have a moderation controller. My threads can be pinned, locked and archived and the opposites, which account for six different routes in the ModerationController.

Sure, I could make a PinThread-, ArchiveThread and LockThreadController, but then I have three separate controllers.

Which has the preference, according to common standards or practices?

Thyrosis left a reply on Emailing In Bulk • 11 hours ago

It depends on how you host your application.

If its on a shared host, they usually have limits as to how many emails are allowed to be sent out every day. So that won't work.

When you host your own server, there is usually no limitations. But, if you don't set up your email properly, you'll end up in spamfolders and be blacklisted before you know it.

Avoiding this takes work and knowledge of emails, spamfilters and DNS. For instance, you'll need to set up your SPF records and use DKIM and your emails need to comply with certain rules.

Using mailchimp takes away all these worries. They make sure their mailservers are set up properly and that no foul mails are being sent from their servers. You just have to provide them with the email addresses and the content, they do the rest.

18th October, 2017

Thyrosis left a reply on Route Resource/CRUD Problem With Slug And Id • 1 day ago

Maybe you can play around with the order of the lines in your routes file. Sometimes an uri matches a route too soon in the file and the route you want it to take gets ignored.

What you could also do is make sure your slug is unique and then forgo the id completely. You can use the getRouteKeyName method to override the way Laravel expects the unique identifier to show up in the uri. Append a counter to the slug to avoid duplicates.

7th October, 2017

Thyrosis left a reply on How To Confirmation Before Delete Record From Database? • 1 week ago

Easiest way is probably to have some javascript catch the submit buttons click and pop up an alert to ask for confirmation. On yes, have the form submitted to the delete-route. On no, do nothing.

An other way is to create an 'in between' route which is handled by the controller and shows a different view and you put you call to the delete route in that one.

Personally I'd go with the javascript, to keep the routing as basic and restful as possible.

2nd October, 2017

Thyrosis left a reply on DNS Issues With Nginx And .money TLD • 2 weeks ago

I'm not sure whether you changed anything already, but I can reach No problem in either Edge, Chrome or Firefox. I'm being served from

Maybe 'plenty of time' wasn't plenty enough after all :)

30th September, 2017

Thyrosis left a reply on Rewrite Url Problem • 2 weeks ago

A 404 means that you do get to your server, but the file is not found.

What do you get when you visit ?

14th September, 2017

Thyrosis left a reply on Eagerloading Relationship, Maybe Polymorphic? • 1 month ago

Thanks @martinbean, that makes so much sense! Jeffrey did touch upon the polymorph thing but didn't actually go into detail, but your explanation clears things up.

Will try it in my code tomorrow :) Thanks again!

Thyrosis started a new conversation Eagerloading Relationship, Maybe Polymorphic? • 1 month ago

Hi all,

I'm confused about something. I'm following along with Jeffrey's excellent Forum series, but am at the same time customising it to suit my needs (a roleplaying board). So, what I've done is this:

class User extends Model
    public function threads()
        return $this->hasMany(Thread::class);

So far, so good. A user can have many threads.

class Thread extends Model
    public function owner()
        return $this->belongsTo($this->user_type, 'user_id');

A thread, naturally, belongs to an owner. But, the owner is based on the user_type. Here's why:

class Character extends Model
    public function threads()
        return $this->hasMany(Thread::class, 'user_id');

Not only users, but also characters can create threads.

Now, I think I've taken a wrong turn somewhere. So far, all is working fine, I just query a relationship based on the user_type which has been stored to a thread. So the migration for Thread looks like this:

Schema::create('threads', function (Blueprint $table) {

My question is: I want to eagerload the owner of a thread, which isn't working. I'm sure I've missed the polymorphic bit, but I don't have a clue how to get this to work.

The reason I'm asking is that, on a page which shows a thread overview, of course you want it to show who started the thread. This is fine if you only have users, because then Laravel can include the thread.user_id = to the query.

But, for me to get the with('owner') to work, it needs to first know which thread.user_type is set (either App\Character or App\User) before it can do either thread.user_id = or thread.user_id =

Any pointers here? I've included code for which I think is needed to support my question, feel free to ask for more of course :)

Thyrosis left a reply on Laravel On Ubuntu • 1 month ago

For the record, your thinking process needs an update.

I can't even start to play around with Laravel I can't even get the welcome page to display. I'm ready to give up on Laravel and move to express or something because this is just not what I'm looking for. I chose Laravel because it's supposed to be "easier" and friendlier but to this point and I'm still at the very beginning it's proven not to be.

Do you realise that Laravel and Ubuntu/Homestead has absolutely nothing to do with each other? It's like saying "Boiling an egg is so difficult" if the reason for it being difficult is that you first have to install your gas cooker and you don't know how to attach the gas outlet to the cooker or something.

Sure, Homestead is named a lot because it's supposedly an easy way to run local development servers. Truth be told, I dabbled with them a few times. "I can do this", I said at the beginning of the day. I mean, I work at a webhosting company, I should be able to install a virtual server, right?

"I suck at this", I said at the end of the day. So the next morning I happily installed WAMPP, Composer and hey, let's start with Laravel.

So, my piece of advice: Don't let your first introduction with Laravel be spoiled by how you have to set up a virtual server which you've never done. If you get stuck on that part, just use the server/software you're used to using, whether it's WAMP, LAMP or MAMP. Only if you have started using Laravel, you're allowed to decide whether it's easy or not.

13th September, 2017

Thyrosis left a reply on Undefined Variable: Category (View: E:\Laravel\project2\resources\views\pages\category.blade.php) • 1 month ago

So, with your lack of code and information this is a long stretch, but...

Im guessing you're collecting your categories in your controller and storing it to $data['category']. Then in your view you expect $category to be accessible.

So far, so good. So either category is undefined in your view because it is actually not passed from the controller to the view, or because maybe you override it somewhere later.

Thyrosis left a reply on Send Email On User Registration • 1 month ago

You're connecting to port 2525 to connect with the Google mailservers, which is not accepted.

I'm pretty sure their settings should be port 465 and encryption SSL, but I could be wrong on that. Have a look at the Gmail documentation for remote SMTP connections for the correct settings.

Thyrosis left a reply on Laravel Vs Plan PHP With No Framework • 1 month ago

From personal experience I can tell you that switching over from plain old PHP to a framework seems like a hassle at the start. You need to relearn certain concepts and sometimes you're like "I could have done this so much quicker the old way".

But somewhere along the line of your first project (for me it was when I hit the point where I'd laid down the groundwork and was starting to delve deeper in the different pages, controllers and views etc), you'll come to realise that from that point, everything goes so much quicker and smoother.

It took me three tries (and three frameworks) to get my head around it. Started with Zend, then Symphony, they both failed miserably. Then I was introduced to CodeIgniter, which gave me my lightbulb moment. Switched to Laravel for the next project and haven't looked back since.

4th September, 2017

Thyrosis left a reply on Catching TokenMismatchExceptions In Handler • 1 month ago

@bashy I don't think it will. The instanceof will just check if the given object is an instance of a given class by checking the class and of the model against the name given.

It will not check if the given class and actually exists. For the instanceof check, its just a name, nothing more. That's why you need to import the class or use it's full path for this to work.

Thyrosis left a reply on File_get_contents Failed To Open Stream: Connection Timed Out • 1 month ago

Tell PHP to ignore the error by adding an @ symbol before the function call.

$data = @file_get_contents($burl, false, $context);

See the PHP documentation on for more info.

Thyrosis left a reply on Catching TokenMismatchExceptions In Handler • 1 month ago

To debug, as soon as you hit the render-method, dd($exception).

You're probably looking to match Illuminate\Session\TokenMismatchException, not just TokenMismatchException. Unless you import Illuminate\Session\TokenMismatchException of course.

Thyrosis left a reply on Mail Bcc • 1 month ago

It's pretty simple really. Don't send them in one go, but send them to each recipient individually.

Or, if you want to stick to using the bcc-option: Send the email to yourself first and then add all other recipients as bccs. So if your sending a news letter for instance, have the news letter sent to '[email protected]' and then add and as bcc recipients.

1st September, 2017

Thyrosis left a reply on Curl Error 7 : Couldn't Connect To Host • 1 month ago

Usually to do with some port restriction or firewall.

Why would you use guzzle for your mail though, instead of the mail library? Isnt guzzle used for http traffic?

25th August, 2017

Thyrosis left a reply on Create A CMS Backend With Laravel • 1 month ago

I would suggest starting with the beginner Laravel tutorials right here on Laracasts. The 'starting with Laravel 5.4' series lets you create a blog, and a dashboard is nothing more than a place where all the create and edit routes are collected.

11th August, 2017

Thyrosis left a reply on Following The Series Forum With Laravel And TDD • 2 months ago

It means you haven't set your allowed attributes to be mass assigned.

Easy fix, add this first in your model definition:

''' protected $guarded = []; '''

10th August, 2017

Thyrosis left a reply on Lets Encrypt Staging Ssl , Always Fail To Install • 2 months ago

The error LE returns is:

DNS problem: NXDOMAIN looking up A for

This means that for some reason, the A record staging.{yourdomain.ext} doesn't resolve properly (yet). When did you make the change in CloudFlare? DNS changes can take up to 24 hours to become active.

Thyrosis left a reply on How Many Of You Are Agree With The Idea That We Need Laracast Mobile App ? • 2 months ago

I do watch videos on my phone, mainly during short commutes which are ideal to (re)watch a single episode.

But to do so, the site is perfect the way it is. There is no need for an app when the developers/designers have spent this much attention to a mobile/responsive layout.

Also, if you wanted to watch videos while offline, just download them to your phone and watch them with your local video player. Its the whole point of the download option in the first place.

5th August, 2017

Thyrosis left a reply on Laravel 5.5 Minimum Requirements • 2 months ago

I'm pretty sure I read somewhere that MySQL 5.6 is the minimum version it'll run on, but now I can't find it anywhere.

Might have actually been while installing Laravel 5.5 on my PHP 5.6 server and it complaining about requiring PHP > 7.

But, upgrading your MySQL to 5.6 shouldn't be too much of an issue or cause upgrading issues. I've upgraded a lot of servers and haven't had any complaints yet.

4th August, 2017

Thyrosis left a reply on Sending Forms Bitween Users • 2 months ago

I don't have any experience with Envoyer, but isn't this just a case of storing the users form-answers in a database and pull them up when the admin views the user profile?

# Migration
class CreateFormsTable extends Migration
    public function up()
        Schema::create('subscriptions', function (Blueprint $table) {

# User class
class User
    public function forms()
        return $this->hasMany(Form::class);

# Form class
class Form
    public function user()
        return $this->belongsTo(User::class);

# Admin controller to show user profile
public function show(User $user)
    return $user->forms;

Thyrosis left a reply on Creating A Sub-Domain For Every Client And Providing An Inbound Email ID • 2 months ago

Ah, then you don't need subdomain mailaddresses at all.

When I get a mail from Asana, I reply to

So Asana only has to monitor that specific email address. The part before the @ is probably a unique hash given to each task, so that internally it'll fetch the local recipient part and find a task for it.

The same will be true for you. You could create one central e-mailaddress '[email protected]' to which you can set a catch-all too. Then, let your users send emails to {randomstring}, it will be delivered to your [email protected] This you can easily parse using the PHP IMAP functions @CodebyRay already mentioned.

Thyrosis left a reply on Creating A Sub-Domain For Every Client And Providing An Inbound Email ID • 2 months ago

For the SAAS URL, you need to work with something like subdomain wildcard in your Apache/webserver configuration.

In out of the box webserver configurations, non-existing subdomains will not resolve to any HTTPD-container unless you specify a wildcard for, so that any subdomain ( will be served by the main Laravel application.

Now, from there you'll need to do something with your routing, so that you can catch the subdomain ( using parse_url() and explode() maybe? ) and translate that to the specific companies data somehow.

I'm not really sure what you mean with an internal mail id? Like, the internal mail IDs are not used for any 'real' mail communication crossing the internet, but only for like private messages or something? Because as soon as the internet gets involved, you'll need to work with subdomain MX-records and mailservers.

1st August, 2017

Thyrosis left a reply on Start With 'Laravel 5.4 From Scratch' • 2 months ago

Personally, I started with the 5.4, then the what's new in 5.5 and the forum/tdd course.

With those three all caught up and some experience on live projects under the belt, I've watched the 5.1, 5.2 and 5.3 courses, picking out subjects I wanted to know more about and weren't mentioned in more recent courses.

Sure, there are still production sites running 'legacy' releases, but it also depends on what your goal as a developer is. Will you work for yourself on new projects or will you work on existing applications running older versions? If the latter is the case, watching older courses is a must.

11th July, 2017

Thyrosis left a reply on Deploy Laravel 5.4 App In Shared Hosting • 3 months ago

I might be understanding you incorrectly, but the way it should look is this:

-home folder --app/ --bootstrap/ --config/ --database/ --logs/ --resources/ --routes/ --stats/ --storage/ --tests/ --vendor/ --www/ --.env --artisan --some composer/phpunit/package files --server.php

Now, the www in this setup is YOUR www. It used to be Laravel's 'public' folder, which you renamed to www (or you just moved the contents of the public folder to the www folder.

Hope that makes sense?

4th July, 2017

Thyrosis left a reply on Deploy Laravel 5.4 App In Shared Hosting • 3 months ago

Yes, sure you can. You don't actually need ssh access to run a production site.

When you're finished developing your application, just transfer all the files online via ftp to your shared hosting package and you're good to go. Make sure you check out where to pur your files though: Usually there is something like a public or public_html folder. This should correspond to the public folder from Laravel. In other words, all other files should be outside it.

3rd July, 2017

Thyrosis left a reply on Check Box Data Type In Migration File • 3 months ago

It depends on what you use the checkbox for.

If it's a 'yes or no' checkbox I'd go with a boolean.

But if it's a 'do you like... Bunnies, cats, dinosaurs, dogs' multiple checkbox, you could use json (or text, depending on the database you use).

1st July, 2017

Thyrosis left a reply on Undefined Property: • 3 months ago

Seems like either your item doesn't have a name, or your orders variable isn't a collection of items.

Easiest way to debug is to dd your item first. Probably its not the thing you want to see, then dd orders to see what's in there.

Thyrosis left a reply on How To Remove Slug In URL • 3 months ago

You can't, unless your movie title is unique. If your movie title is unique, you can use the slugified title as slug and don't need the random string at all.

But the way I read your snippets now, that random piece of string is actually the slug and a unique identifier in your URL, so you can't leave that out.

30th June, 2017

Thyrosis left a reply on Send Email Every Minute Using Cron Job • 3 months ago

Well, the Laravel scheduler takes care of everything for you. The only thing you have to do, is to tell cpanel to run the scheduler every minute to see if it needs to do something.

If you only want the cron to run at the specific times set by you, you should have it perform a task itself, not call the scheduler. E.g., get the cron to wget or curl one of your routes.

Also, if you use >> /dev/null 2>&1, you're actually telling cpanel not to send you an email. It means as much as 'any output you may have, just send it straight to the void. I don't want it'. Get rid of that big and you'll at least get the cpanel output.

24th June, 2017

Thyrosis left a reply on End To End Encryption • 3 months ago

Why not just use an SSL certificate for encryption while messages are sent across the internet and encrypt/decrypt the messages on the server side?

20th June, 2017

Thyrosis left a reply on Re-write Non-framework Php Project On Laravel 5.4x? • 3 months ago

I'm not sure whether there is a 'best' way to do it.

Personally I've had to do this twice and both times I've started from scratch. With the old project, you have an overview of the end product. You have your classes, your routes, your database structure all worked out.

From there, it's just a matter of porting it over to the Laravel way, which is (I think) easier than trying to copy/paste code.

Thyrosis left a reply on Laravel Code - Vulnerable To Mysql Injections? • 3 months ago

I think Laravel takes care of this out of the box by using PDO parameter binding.

This might be an interesting read for you:

That said, if there are any security tips to avoid applications being abused like this, I'm interested in reading them as well.

Thyrosis left a reply on Migrate Run Error • 3 months ago

Hi Anosh!

This is a very well known error you've run into.

Check for the solution.

19th June, 2017

Thyrosis left a reply on SEO Tips • 4 months ago

Agreed. Laravel takes care of your back end mainly, and gives you an easy way to handle your (stored) data to a browser.

Google ranking is related to the way it looks in that browser, but doesn't care if that content is generated by WordPress, Joomla, static HTML or Laravel.

In other words, broaden your search to just general SEO tips and apply them in your application. Most notable are things like good styling and page layout with headers, paragraphs, good content, things like that.

13th June, 2017

Thyrosis left a reply on Remove Cart • 4 months ago

Right, something simple of the top off my head:

if ($request->session()->has('cart')) {
    $cart = $request->session()->get('cart');
    $cart[] = $product;
} else {
    $cart = array([$product]);
$request->session()->put('cart', $cart);

It all depends on how you structure your application, but you haven't given a lot of details so there's not a lot to work with.

Maybe it pushes you in the right direction :)

12th June, 2017

Thyrosis left a reply on Private File Access • 4 months ago

@maxnb it's not impossible at all to find the files using your system. It all depends on the purpose.

Because if I've downloaded the files once, the location is saved in my history. Now, say I cancelled my membership at your site, I shouldn't be able to access the files any more. After all, im not paying for them any more. Yet, using the direct link in my browser's history, I just have visit the link and I'm there.

Even worse, I could pass that URL on to friends and they could download it, even if they don't even have an account.

Thyrosis left a reply on What Is The Difference Between Two Codes Yielding (so Called) Same Result.?? • 4 months ago

@rajG , the end result for using either of those methods are the same: a new Post will be added to the database.

Which method you use is down to you, personal preference and situation. If you just need to take the form-input and store it into the DB, then the create() method using the $request-parameters will do just fine.

But like you said, if you need to manipulate content before storing (like creating a slug for your post title, for instance), then you can use the save method.

Or, alternatively, load the $request array into a local array, add or edit some values and then pass it through to a create, like so:

$tempArray = request(['title','description','url']);
$tempArray['slug'] = str_slug($tempArray['title']);

Hope that clears things up for you :)

11th June, 2017

Thyrosis left a reply on MariaDB Or MySQL • 4 months ago

MySQL only supports JSON from 5.7 onwards, but 5.7 introduced some new issues (something to do with passwords I think, not sure exactly).

But yes, MariaDB also supports JSON columns as of (I think) 10.1. And you could also just use a text field ;)

10th June, 2017

Thyrosis left a reply on Running Tests, In Sublime Text, On Homestead, On Windows. Yeah. I Know. • 4 months ago

I hear ya. Doing the same, apart from either having an SSH connection to a remote Linux server and performing the tests there, or running WAMP locally.

It took my a lot of configuration to get PHP to be available to the command prompt and being able to run my tests just like that, but it is possible. If you need to know how, I could see if I can track down the necessary steps.

Homestead is foreign territory for me though, can't help you with that I'm afraid.

Thyrosis left a reply on A_guest_can_see_nothing_but_login • 4 months ago

I would make an array of all available routes and then use foreach to expect a login redirect or authentication exception on each route in the array.

That way you only have to spend some time to create an array of all routes, which is easily done with some multi line text editor like Sublime.

9th June, 2017

Thyrosis left a reply on It Is Ok To Use LetsEncrypt Free SSL? • 4 months ago

The problem with LetsEncrypt is that it will most likely fall out of grace relatively soon. That means LetsEncrypt certificates will also generate the 'Untrusted site, are you sure you want to continue'-warning just like a self-signed one, which won't defeat the purpose of the certificate, but will make public perception rule against you.

There are a few reasons for this, but in a nutshell: paid certificates involve some kind of human interaction or extended validations. Even for the simple Comodo Essential certificates, Comodo runs the requested certificate through a set of validation rules and denies the application if it doens't pass the tests.

Now, for LetsEncrypt, there are no such checks. You want a certificate? Sure, here you go. You want it for Sure, here you go. The ease with which phishing sites are now 'secured' is astonishing.

The problem lies in the public perception. The site is SSL-secured, therefor the site is to be trusted. And because us smart cookies need to protect the easily persuaded part of the population that doesn't really have indepth knowledge of this stuff, before long Mozilla and Google will start handing out warnings.

Thyrosis left a reply on Nothing To Show • 4 months ago

Hey @abubakar, I think you may have forgotten to paste in some information :)

Thyrosis left a reply on Question About Laravel 5.5 • 4 months ago

Probably also because by the time Laravel 5.5 is officially released in about two months, PHP 5.6 won't have been actively supported for half a year and will only receive security updates for another 18 months.

If they launch Laravel 5.5 as a LTS with 2 years of support, they'll have to be supporting Laravel on a PHP version of which they know in advance that it won't be patched for another 6 months.

That being said, I'd actually assume that they'd set PHP 7.1 as the minimum requirement (not 7.0) because even though PHP 7.0 will be supported for longer, security support actually ends earlier.

Thyrosis left a reply on Laravel Email Not Send On Share Hosting • 4 months ago

Two things that could be an issue here:

1. Wrong settings The Gmail SMTP servers and the connections are encrypted with SSL and are accessible through port 465. For TLS encryption, use port 587. So it depends on the type of encryption you've set in your .env file.

Check for the settings you need to use for your type of account.

2. Blocked port/mailservers I don't have any experience with GoDaddy at all, but maybe they've blocked outgoing SMTP connections to remote servers on their shared hosting platform. This is probably a less likely option, so I'd check #1 first.

6th June, 2017

Thyrosis left a reply on Any Site Similar To Laracast? • 4 months ago

If you're looking for the discussion forum side of Laracasts, you could try .

It's probably one of the most active forums on development around and has different subforums for both PHP and JS.

Thyrosis left a reply on Transferring The Laravel Project On Server • 4 months ago

Check this page from the Laravel docs:

It's a matter of changing a config file and adding a sessions table in your database (there is even a migration for it).

Edit Your Profile

Want to change your profile photo? We pull from