24 Best Reply Awards

  • Member Since 1 Year Ago
  • 319 Lessons Completed
  • 0 Favorites

20th July, 2018

Thyrosis left a reply on Blade Directives - Why? • 1 day ago

I suppose it depends on what the actual logic and purpose of your directive would be.

I personally use them to extend easy authorisation checks, like @ admin or @ moderator as supplements to the out of the box @ guest and @ auth.

If you are looking to replace @ include, I think your purpose might not be something to use custom blade directives for or you need to rethink the way you structure them.

18th July, 2018

Thyrosis left a reply on Cannot Migrate Database • 3 days ago

This is just a regular access denied message. You most likely don't have a user 'homestead' on the mysql server.

In that case, you need to change the .env file with the correct user credentials to log in to the mysql database you need. Log in to phpmyadmin as root and create a database with user, set those in your .env and your good to go.

15th July, 2018

Thyrosis left a reply on Display Exception Message In A Secure And Proper Way • 6 days ago

@scala if your showing output to the end user, your application is in production mode and app_debug should be false by definition.

Live or production environments should never have app_debug to true imho, for exactly the reason you are now asking for another way around it.

13th July, 2018

Thyrosis left a reply on Queue:work Not Responding • 1 week ago

Hmm. And in your database table, the queued jobs show up in your jobs table?

As you work your queues, do the attempts in the database table go up? Are they available immediately or are they set for future sending? Showing a few lines of your jobs table might help.

Thyrosis left a reply on Queue:work Not Responding • 1 week ago

What are your env and config like?

Also, do you wait long enough with pressing ctrl c to let the queue work?

12th July, 2018

Thyrosis left a reply on Accessing Object Properties... • 1 week ago

Cannot access private property

This usually means there is a public getLatitude() method or something to fetch the contents of a private variable.

Or a result() method which returns whatever you need.

I just quickly skimmed through the git repo, but my phone is being a pain so I cant really look properly for the thing you might need.

6th July, 2018

Thyrosis left a reply on Hi Everyone, I Am Really New Laravel Learner. I Have Some Error That Want To All Of You. I Got The Error As Below When I Ran "phpunit". Thank In Advance..! :) • 2 weeks ago

Are you using databaseMigrations or refreshDatabase in your tests?

For instance, in the phpunit.xml file, this is my configuration for php:

        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
        <env name="MAIL_DRIVER" value="array"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>

Notice the DB_CONNECTION and DB_DATABASE pointing to a SQLite database in memory.

Then, in the test itself:


namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class ExampleTest extends TestCase
    use RefreshDatabase;

     * @test
    public function aPostCanBeRead()

Notice the use of Illuminate\Foundation\Testing\RefreshDatabase to have PHPUnit run migrations at run time.

Hope that helps!

5th July, 2018

Thyrosis left a reply on How To Properly Install A Package • 2 weeks ago

Seeing as it's a package you install, it will always be installed in the Vendor directory. Why do you expect anything in your project folder?

Only the migration and config files are pushed to the project's directories. All the other files remain in the vendor-directory.

Thyrosis left a reply on Proc_open() Has Been Disabled For Security Reasons • 2 weeks ago

As Lostdreamer said, it's a server setting. If you have control, you can change it. If not don't fret.

If you get the error message while using Composer, it shouldn't matter. It'll just find another way to do what it needs to do.

1st July, 2018

Thyrosis left a reply on Modifying Column Type To BigIncrements Without DBAL Library • 2 weeks ago

Ah, right.

Well, in that case I would run an update script.

Step 1: Add new ID column user.blogid Step 2: For each user, copy value from to user.blogid Step 3: Remove column Step 4: Rename column user.blogid to

As im typing this, I realise that renaming might also require the DBAL package. Im not sure. If it does, this won't work either.

Thyrosis left a reply on Modifying Column Type To BigIncrements Without DBAL Library • 2 weeks ago

Can't you just edit the original users migration file so that on a new installation, the id column is made using the correct integer type?

This would require you to not have any applications already live or having access to phpMyAdmin or similar on live servers.

Dropping the ID column would mean also dropping all content in that column. There won't be any way to restore the user ids in the newly created id column. Which means that the post from user with id 28 will now be orphaned, because that user now has a different id.

29th June, 2018

Thyrosis left a reply on Why Not Laravel Support Officially Graph DB? • 3 weeks ago

I did a little digging into GraphDB (always interested to learn new things) and found this on Wikipedia:

As of 2017, no single graph query language has been universally adopted in the same way as SQL was for relational databases, and there are a wide variety of systems, most often tightly tied to one product.

I don't know how popular GraphDB is, but this might well be the reason why GraphDB hasn't been introduced within the Laravel Core. If there is no single language to talk, I can imagine it's very hard to develop support for it.

There's an interesting discussion over at Quora why Graph databases aren't more popular too:

The bottom line seems to be a lack of adoption. Maybe you can persuade Taylor to integrate a default Graph driver in Laravel 5.7. To improve adoption rates ;-)

27th June, 2018

Thyrosis left a reply on About Queue And How To Set Them Properly For Emails Notifications • 3 weeks ago

The scheduler isn't the queue worker. They are not related at all.

The schedule is run each minute and based on your kernel file, it will execute the jobs you've scheduled there for every minute, every five minutes, each day at 3:40AM or whatever you've set.

A queue-worker is a continuously active process which monitors the queue and processes a job as soon as it enters (unless delayed by your code). For this to work, you need to start queue:work via the terminal and leave it running.

Now, here is your problem. As soon as you restart the server, your never-ending-process will be killed. So you'll need a way to have this automated. From the Laravel docs:

To keep the queue:work process running permanently in the background, you should use a process monitor such as Supervisor to ensure that the queue worker does not stop running.

Check for how to work SuperVisor on an Ubuntu system, or if you don't use Ubuntu as an OS.

Thyrosis left a reply on Problems With Seeding? • 3 weeks ago

Could it be the set remember_token? You could leave it empty in the first place, as you don't need to seed it.

Have you tried catching the errors while logging in? Sure, validation would say "incorrect credentials", but behind the scenes there might be a more elaborate error.

Thyrosis left a reply on Error In @section • 3 weeks ago

When using @section, you're already in a control structure between the ( and ).

So instead of passing the value within curly brackets, you need to pass them through as a plain variable, like so:

@section('ogtype', $node->type)

19th June, 2018

Thyrosis left a reply on Load Multiple Scripts Inside Javascript • 1 month ago

Might be thinking out of the box here, but can't you just include

<script src=""></script>

in the HTML instead of using JS-functions to load something?

Thyrosis left a reply on How To Use User Defined Authentication In Laravel? • 1 month ago

Hi Abdul,

It's really simple actually. I just searched google for "laravel authentication username" and this reply came up first:

Seems like a very easy way to achieve what you need! :)

Thyrosis left a reply on Drag And Drop Tree Without Libraries • 1 month ago

Of course you can! Nobody is forcing you to use the libraries. If you have the necessary javascript skills to write a draggable tree without a library, go for it.

18th June, 2018

Thyrosis left a reply on Currently In Progress • 1 month ago

Ah, maybe we're talking about different lists.

I'm guessing you're thinking about the list when you click on Catalog in the main navigation?

I'm talking about the one when you click on Series in the main navigation. If you use the Grid view, the page will start with a section "Currently In Progress", followed by 6 courses. Then a section "Recently Updated", "Trending Series" and then some more sections.

But that first section of six courses doesn't get cleared. At least, not for me.

Thyrosis left a reply on Currently In Progress • 1 month ago

Oh no, I did use it. But I still have the same six courses on the Series - Currently In Progress list.

Thought it might be cached results, but logging out and in didn't clear it either.

Thyrosis left a reply on Currently In Progress • 1 month ago

Hi @Cronix,

I did see those buttons, but they only seem to clear individual lessons you've started watching and didn't finish yet. It doesn't offer the option to remove a complete series.

At least, if it does, I don't know which filter to use to pull up those buttons.

Thyrosis started a new conversation Currently In Progress • 1 month ago

Hi @JeffreyWay (or any of the experienced users on the board),

Just something silly. I've been working my way through a lot of courses. When I click on Series, it shows me 6 "Currently In Progress" series. Apart from one, all of them are finished (both by me as by Jeffrey). Like the Forum course, Sublime Mastery and Git Version control.

Series I'm actually currently watching, like the CSS for developers and Testing Laravel, are not in the list.

Am I missing a "Complete this series" button somewhere? Where I can tick off a completed course, so it'll disappear from the "Currently In Progress" list? Because those finished courses are clogging up my display and are hiding actually in progress courses.

Thanks for reading!

Thyrosis left a reply on Scoring Each Participant By Adjudicator Of Same Category • 1 month ago

Okay, the way I understand you @Mykelcodex, there are:

  • Many Participants, whom have
  • Many Videos, for which
  • Many Adjudicators leave
  • Many Scores

That sounds like a Video belongsTo a Participant. Each Video hasMany Scores. Each Score belongsTo a Adjudicator.

So the Score migration would look something like this:


On video, you would have a scores method:

public function scores() {
    return $this->hasMany(App\Score::class);

So Video->scores will return a collection of scores, from where you can do your calculations (average rating, amount of scores, which adjudicators scored, etc).

The only thing I'm unsure about is the category you mentioned. Is it like gymnastics where participants are scored by both performance and technique? So each Adjudicator scores a Video twice?

In that case, add another column to the migration:


Then you could define other relationships on Video too:

public function technicalScores() {
    return $this->hasMany(App\Score::class)->where('category', 'technical');

So Video->scores would return a collection of all Scores related to that video, but Video->technicalScores would return a collection of only the scores in the technical category.

Of course, you could extend by making Category it's own model and then make a relationship from Score to Category, but that's up to you.

Hope that gets you somewhere!

Thyrosis left a reply on Laravel Queue:work And Connection Not Killing Going In Sleep Mode. • 1 month ago

Well, the value 180 is obviously the amount of seconds that the connections are allowed to be interactive. Adjust them to your needs, in your case set them below 60 to avoid multiple connections being kept open.

Have a look here.

12th June, 2018

Thyrosis left a reply on How To Store IMAGES Outside Public Folder • 1 month ago

I think the real question is: What do you mean by 'safest places'? Do you mean safest for you not to throw them away by accident? Or safest to not include them to your git-repo? Or something else entirely?

Because whether you like it or not, images need to be publically available to be able to be loaded by users in browsers. Sure, don't put them in public but use the storage/assets folder. Happy days. Just don't forget to create a symlink from the public directory to wherever you put them because one way or another, your visitors need to access them. Publically.

6th June, 2018

Thyrosis left a reply on Model->increment() Not Working In Middleware • 1 month ago

I dont see ID being set somewhere, but it might just be outside of the scope you posted.

Best way to check is to dump/dd the result of Imov::find($id) and check if it actually is a model or not.

3rd June, 2018

Thyrosis left a reply on Localhost Works But Server Show Error • 1 month ago

The fact that your error is pointing to your local E:\xampp installation on your Windows environment makes me think you've got a filepath hardcoded somewhere.

Check your file config-files, maybe your .env file or your code where you upload your files for paths.

1st June, 2018

Thyrosis left a reply on 3d Party Integration • 1 month ago

There are probably different ways to achieve this. I make a dedicated Library which I use to connect to the third party and write all the functionality in functions.

So I new up a new Mail

Thyrosis left a reply on Is Version 5.6 Really This Much Faster Than 5.4? • 1 month ago

Also, Laravel 5.4 used PHP 5.6 as a requirement. Laravel 5.6 runs on PHP 7.1 or greater, which means it can benefit from the improvements in PHP 7 which made it that much faster.

30th May, 2018

Thyrosis left a reply on Object Of Class Illuminate\Support\Collection Could Not Be Converted To Int • 1 month ago

Well, there's your answer.

$students[$index] is an array of collections and each collection holds an array. You are going to have to use (multiple) foreach to update the value you want.

Thyrosis left a reply on Object Of Class Illuminate\Support\Collection Could Not Be Converted To Int • 1 month ago

Have you dumped $students[$index] to see what kind of variable it is?

You're treating it as an integer, but its most likely a collection of results from the query.

29th May, 2018

Thyrosis left a reply on Unable To Add A New Field In Users Auth Controller • 1 month ago

'username' => "some dynamic value",

General error: 1364 Field 'username' doesn't have a default value

Double check whether your dynamic value is parsed through properly. Doesn't look like it.

Also, this might just be a typo, but the first error reads

1364 Field 'usernmae' doesn't have a default value

Username is spelt incorrectly there.

25th May, 2018

Thyrosis left a reply on How To Install Laravel Package On Webserver? • 1 month ago

@mohansinghbomrel Composer.json is a list of packages you want. Composer.lock is a list of all packages including the exact versions which are installed. It also includes things like dependencies.

24th May, 2018

Thyrosis left a reply on Populate Database In Laravel • 1 month ago

@Cronix good point, never thought about it that way!

Thyrosis left a reply on How Do I Check The Logged In User's Username With Controller Logic? • 1 month ago

The auth Facade isn't available in the constructor method yet since Laravel 5.3.

If you're redirecting based on username, you could make a middleware to make that happen. Or, if it's just the one username, add it in your routes file as an explicit route.

23rd May, 2018

Thyrosis left a reply on Populate Database In Laravel • 1 month ago

I've recently migrated away from my WordPress blog to one I've built myself using Laravel. For this, I've used seeders to copy the database:


use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class DatabaseSeeder extends Seeder
     * Run the database seeds.
     * @return void
    public function run()
        // And then the WordPress posts and comments
        DB::unprepared(File::get(base_path() . '/database/seeds/wpposts.sql'));
        DB::unprepared(File::get(base_path() . '/database/seeds/wpcomments.sql'));
        DB::unprepared(File::get(base_path() . '/database/seeds/wpterms.sql'));
        DB::unprepared(File::get(base_path() . '/database/seeds/wptags.sql'));
        DB::unprepared(File::get(base_path() . '/database/seeds/wppostterms.sql'));

The SQL files are just plain SQLdumps/exports from the WP-database, retrieved using PHPMyAdmin, added to the database folder and called by running

php artisan migrate --seed

That's all there is to it :)

Thyrosis left a reply on Learning Laravel • 1 month ago

Just out of curiosity...

Am I the only one tempted to answer "Nope, can't help you. We only swap awesome pancake recipes" when questions like these pop up? ?

18th May, 2018

Thyrosis left a reply on How To Run Workers When There Is A New Queue Job Coming In? • 2 months ago

Cronix didn't mean not to use queue workers, he meant to use them what they are made for.

A queue worker is a continuous process that runs in the background. You don't start a queue worker if and when it suits you. You start it when you deploy your application and then have it run I definitely.

On your Mac, start a terminal and run artisan queue:run. Leave that terminal open and see what happens when you fire off jobs.

Then deploy your app to your webserver, start your queue (use screen if you can't use supervisor in your webserver either) and be happy.

There's a thread on here from last week about using screen for queues. Have a search and you'll find it.

14th May, 2018

Thyrosis left a reply on Show Notification And Mark As Read In One Click • 2 months ago

One thing you could do is to have the notification marked as read as soon as someone clicks the link.

This is my controller with the show method:

class UserNotificationsController extends Controller

     * @param  int  $id  Notification ID
     * @return \Illuminate\Http\Response
    public function show($id)
        $notification = auth()->user()->notifications()->where('id', $id)->first();

        if ($notification) {
            return redirect($notification->data['link']);

So when you click on the notification, it links to the [email protected] method. There it finds the notification, marks it as read and then redirects the user to the intended page. This page is stored inside the link-property of the notification data.

11th May, 2018

Thyrosis left a reply on Continue Running Artisan Command Even After Terminal Is Closed? • 2 months ago

Youre probably thinking of the queue worker, which is also an Artisan command running continuously.

The easiest way is to run the command in screen. Have a google for your operating system, followed by 'screen', but it should just be a case of


php artisan your command ctrl a + d

Hold ctrl while pressing a and d after each other will exit the screen and return to your normal terminal. Now you can safely disconnect from your server while the screen keeps on going.

To reconnect:

screen -r

10th May, 2018

Thyrosis left a reply on Running Scheduler Another Way Other Than Cron? • 2 months ago

How about sending the emails to a black holed email account? Or, if you need to do something with the output, send it to a box which your application pops and processes the messages from?

9th May, 2018

Thyrosis left a reply on Trying To Add A Post To The Database... • 2 months ago

You mistyped a -, should be


Also, why the enctype? It's usually only used for file uploads, which are not in the form you posted?

Thyrosis left a reply on Does Anyone Else Get Craziness From The Laravel Collective On Browsers Such As Safari And Firefox? • 2 months ago

I don't use the colllective, but running into similar issues with the DateTime type input field. Both Edge and Chrome present a nice date+time field, but Firefox flat out refuses to do anything with it. There have been github requests and issues for it since 2016 but is still not implemented.

So yes, like Cronix suggested, it could also be the browser rather than the tools.

Thyrosis left a reply on Putting First Character Of Current Authenticated User Into My Blade Template • 2 months ago

I don't know what you're doing wrong, apart from not giving us a lot to work with.

Like, does it give you an error? What does the outputted html look like (is it just an empty span or isn't any of your div/span code shown)? What happens if you just hardcode a letter, like M (wide) or I (narrow)? Does it show then?

7th May, 2018

Thyrosis left a reply on How Do I Combine Three Foreach Loops Into One ? • 2 months ago

Just out of curiosity, why have separate entries at all? Why not structure your table like this:

id = 1 , code = ' 123 ' , amount_plus = '200' , amount_minus = '100' id = 2 , code = ' 456 ' , amount_plus = '400' , amount_minus = '500'

If I read your question correctly, won't that make it a lot easier to sort and display?

4th May, 2018

Thyrosis left a reply on How To Run Laravel On Wamp Server • 2 months ago

Can I point wamp to my current directory in my dropbox folder like I can do with Mamp?

Yes you can. After installing WAMP, visit localhost. It'll show you some info on your local server, including the option to create virtual hosts. The directory should then be set to your local Dropbox location.

Thyrosis left a reply on Can't Add Post With # In Title • 2 months ago

When retrieving the model based on the slug, you'll run into an issue.

For instance, when your title is "Happy#day", the slug will be "happy#day-timestamp". This is done here:

$post->slug = str_replace(' ', '-', strtolower($post->title)) . '-' . $now;

But, if you request this post, the request will look like this:


So this will result in Laravel fetching the post with slug 'happy' for you. After all, #day is something you use in your HTML to skip to a specific anchor on the page.

And of course, a post with slug 'happy' doesn't exist in your database.

What you should do instead, is create your slugs with Laravel's out of the box string/slug helper:

$post->slug = str_slug($post->title) . '-' . $now;

This way, an URL friendly slug will be created and you won't run into any issues with models not being found (and consequently, trying to get properties of non-objects).

1st May, 2018

Thyrosis left a reply on Updating Using Filezilla Not Working On Digitalocean • 2 months ago

and when deleting file I get error for that

Which error is that? There could be so many causes. Permissions, quota, connection issues. Specifying the error will definitely narrow it down.

21st April, 2018

Thyrosis left a reply on Laravel $request->all() Is Empty But $_POST Returns The Actual Posted Data Correctly • 3 months ago

What happens when you use request()->all() instead of $request->all()? Maybe the request variable gets overwritten or the route model binding is bust?

12th April, 2018

Thyrosis left a reply on Best Practice Accessing Other Controller Method • 3 months ago

I suppose you could look at is as if it were steps.

Step 1: Visitor check in.

Upon finishing the check in, check the request for something that indicates the user also wanted to print the badge. If not, finish this request by returning a view or redirecting to the homepage or wherever. If so, redirect to step 2:

Step 2: Print badge

This is the [email protected] route where you print the badge. It doesn't need to be aware of which button the visitor pressed to get here, all that matters is that it prints a badge.

This way, both controllers continue to operate independently of each other.

Edit Your Profile

Want to change your profile photo? We pull from