Member Since 4 Years Ago

Experience Points

3,870 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
Best Reply Awards
Best Reply
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 7
31,130 XP
3 weeks ago
Activity icon

Replied to Overwrite Order In SqlQuery

@mohammed_alama does not any effect mean it doesnt die and dump there?

3 weeks ago
Activity icon

Replied to MYSQL And MariaDB

@xtopher what do you mean when you say image the json column? Its either or for the second question, as far as I know the code base hasnt drifted apart enough to matter currently.

Activity icon

Replied to Refactor Huge Eloquent Query

@miggi maybe integrate the relationship functions in to the relationship on the model class. Or make a custom one that includes the filtered, productBonusesForAllClientsWithActiveCurrent, as example.

Activity icon

Replied to How To Sort A Collection By Its Relation In Laravel

@farshadf i am having a hard time figuring out you code. I dont see where $hits, $price, or $data are defined.

Do you mean, if $price is set, the order by sale_price? It sounds more complex than that.

Activity icon

Replied to How To Get Column Values From Multiple Tables In Laravel?

@nomirobin maybe make a relation function in users with it doing the filter for the column doesnt exist part. It would be returned as a sub array/obj in with the users model object.

Activity icon

Replied to Need To Order Posts Based On A Composite Score

@connecteev I would write out a sql statement that does what you want then use that to make a laravel equivalent and in code. Its hard to make that without more about the algorithm and how the weighting is determined.

Activity icon

Replied to Pass Model By Reference?

@bionary i didnt notice you had that actually in you post as already tried. I would do what @talinon offers its the most clean.

If your really wanting a reference style, you could make a service provider and a instance style loader then tie that in to laravels app container.

This is what I mean, https://laravel.com/docs/6.x/container then either as a singleton or a instance.

Activity icon

Replied to Overwrite Order In SqlQuery

@mohammed_alama ok, I would put a dad in the popular function and make sure its being called.

Activity icon

Replied to Installing Spark On Homestead (VirtualBox On Windows 10)

@mattltm not sure what else to try, maybe just scrap that node install and make a fresh one.

Activity icon

Replied to Testing Hundreds Of Sites

@jasonfrye i could see using a job system and a Ajax type web viewer to trigger the test run and to pool the results. You could set it up in a way that you could test a single site or multiple doing that.

If the micro sites are the same code base (per language) then you could expand it to include a call to a test script on the site being tested that would run a more complete site test of other elements. You could write the main test script once then just add it to the sites, perhaps.

3 weeks ago
Activity icon

Replied to CURL Error 35: Error:140773E8:SSL Routines:SSL23_GET_SERVER_HELLO:reason(1000) (see Http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Have you checked the things mentioned in the error reference?


A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others.

Activity icon

Replied to How Do I Setup 2 Homestead Boxes? ( One With Php 5.6 And One With Php 7)

Just for reference, you can use both php 5.6 and php 7 on the same homestead install. Just update the nginx confit for each site to use the php version you want.

Activity icon

Replied to Is It Possible To Prioritize A Package's Routes?

@infernobass7 good to know, I extended the main app class in order to force my load order on the packages.

Activity icon

Replied to Overwrite Order In SqlQuery

Hum, since it is returning the base query, just making sure you did add the filter to the main array, protected $filters = ['by', 'popular'];

You might also did the getQuery after resetting it, to make sure that is working.

Activity icon

Replied to Remove The Session Message After Click On Browser Back Button

Not tested but try


Activity icon

Replied to Installing Spark On Homestead (VirtualBox On Windows 10)

Have you installed the package?

npm install --global cross-env

Activity icon

Replied to Wordpress And Woocommerce For A Laravel Developer?

For a restricted store check this plugin, https://wordpress.org/plugins/woo-products-restricted-users/, I havent used it and there might be others.

For learning Wordpress its just php, the only catch is the hook system (actions and filters) which can be a pain. I didnt find many resources when I started, I just looked at the code of the plugin, and figured out what hooks they used then either added in my own hook or made a custom template that didnt use the original hook.

Activity icon

Replied to Access-logs) Is Not Within The Allowed Path(s)

Ok, should be able to modify the php.ini here, Software > Select PHP Version > Switch to Php Options > Change Value

Then find/add your path to a setting called open_basedir

4 weeks ago
Activity icon

Replied to Homestead Nginx Not Serving Webpage

@danielmunn really,... things have changed for the homestead process in the last 3 years, lol

Activity icon

Replied to Access-logs) Is Not Within The Allowed Path(s)

What shared hosting control panel are you using?

You would need to modify the php.ini or httpd.conf to allow the directory, if your control panel allows that.

Activity icon

Replied to Wordpress And Woocommerce For A Laravel Developer?

Oh Yea WordPress fun, lol. I have been working with WordPress for about 8 or so months now. I started with zero experience with WordPress, saying that because it is not hard to learn just a pain in the butt to use sometimes.

  • Is it in general possible to use WordPress and WooCommerce for a project like this?

Sure, there are tons of sites that use that for their shopping carts, etc.

  • How can i handle authentication and the "membership webshop" in WordPress / WooCommerce?

Options, 1) use the WordPress login, 2) use Laravel auth. I think your going to be required to use the WordPress login for the WordPress stuff, now, you could setup a custom login plugin that would check the WordPress login and if it fails then try the Laravel and then if that fails then treat it as a bad login. I wouldnt do two separate login systems, that would be come very hard to manage later on. I would look at maybe a duel system, where it logins in to both WordPress and Laravel, would just have to figure out how. You could hook in to the account creation an do a api call to Laravel that creates the duplicate user in that system. Then a custom login could login to WordPress, and Laravel at the same time. You would also have to tie in to the password reset stuff.

  • Should I try to convince the customer that we build everything from scratch in Laravel, although he really wants to go with WordPress?

If you want too. But you will need to consider the time needed if writing most everything from scratch (or packages maybe) vs using WordPress and WooCommerce.

  • Should I try to figure out some crazy way to use both, WordPress and Laravel? (e.g. using WordPress for the static pages, handling the webshop in Laravel. But how can the shop admin than manage products and all that..)

I think this would be possible. You can run Laravel in a subdir on the WordPress site, then just modify the WordPress routes to direct the request to the Laravel page. I have some code that I used to overwrite the WordPress routes, so I can find that if you decide to go that route. It would take some tweaking to get it all set up but I am doing something similar in WordPress, just not to Laravel. The alternative would be to run WordPress in the subdir, and the main site would be Laravel. Then you could just use WordPress as an admin interface. You can use (or make) an api to access the data in the WordPress installation. Its possible, the question is if its worth the trouble.

  • a plain WordPress installation with the WooCommerce shop plugin. only used by the clients admin, to create static pages (provide the content) and WooCommerce products

Yes, this is what I would think of in the process.

  • a Laravel installation which pulls all the static pages content and product data from the WordPress API

Two ways to do this, you can either include the main WordPress class then use the WordPress functions to get products, coupons, handle the shopping cart calculations, etc. I dont remember any api that directly accesses the products, but there might be, if not you can write one in maybe a few lines of code. I think I may have some examples of that as well.

  • all the frontend stuff (design, ux) for the static pages as well as

Yes, you can make a custom theme that you can use git to keep in sync. Same with the custom plugins, you can use git on them too.

  • the whole shop implementation (cart, checkout pages, etc) is built in Laravel?

This is the tricky part. You could do all of that in Laravel, but it might be simpler to just use WordPress since it would already be built in and you would only need to make the page templates. I am a big fan of Laravel, but sometimes there is just not a way to work in using it on some projects. You would need to ask yourself, what am I using Laravel to do and is that the most efficient way or would just writing a plugin to WordPress and a custom theme (aka templates) be better.

  • would be possible to visit some weird, not styled WordPress pages (or at least the WordPress index page) on that WordPress installation?

Not a big problem, since you can overwrite the router in WordPress relatively easily. However, it could make the admin management the pages in WordPress a bit tricky.

-- Hope that helps. (really need a markdown preview... lol)

4 weeks ago
Activity icon

Replied to Amazon S3 File Download Not Working -- "File Not Found At Path:"

Very rough, but maybe something like this...

return response()->streamDownload(function ()  use ($s3_file){
    echo file_get_contents(;$s3_file);
Activity icon

Replied to Pass Model By Reference?

Can you do this ?

public function getBrandsList(Task &$task){ $task[] = 'Another error.'; }
Activity icon

Replied to Binding Two Variables In Js

Why dont you just do the e.preventDefault() in the click hook before the call to the smoothScroll?

Activity icon

Replied to Advices To Construct Conceptual Model Of Data

Ok, not sure I totally understand what your asking.

Is this right?

Each Company -> has many celebrants -> each celebrant has one affection per date restricted to (morning or afternoon) -> that affection can have many bookings (aka times) per the time frame (morning or afternoon) up to the limit specified in the affection record

Activity icon

Replied to Testing Hundreds Of Sites

Oh I love a good challenge. So are you only checking if the login is functional or are there other things to test?

For login, I would likely use guzzle and just post a login request to each site then verify based on the html reply. It sounds the easiest to set up for automation or even a web interface. You could set it up using threads then run multiple checks at the same time or stagger them some. You could use php or perl for the test script.

5 months ago
Activity icon

Replied to Seperate Log Viewer Site

@BOBBYBOUWMANN - Thanks for the reply.

Yes something similar to those, but this was a standalone app that i could run locally and not a third-party service. Those might be good for live sites, but I dont want to use a third-party for development.

I'm looking at telescope to see if i can modify it to receive messages via an api call instead of watching the local app. Then on my dev app, i can just set up a logger and "log" things and they get sent to my telescope site for viewing.

5 months ago
Activity icon

Started a new Conversation Seperate Log Viewer Site

Hey All,

I used to have a Laravel package that I could forward my debug output to from my main dev site. I cant seem to find it and I can’t remember the name.

It was technically a logger that send the message/data to the other site for viewing.

Does anyone know of something like this?


Activity icon

Replied to Setting Headers In Middleware

Ok, apparently the dump command actually sends a php header for content type. Didn't know that.

The alternative is https://laravel-news.com/laravel-dump-server, which is interesting.

Activity icon

Replied to Setting Headers In Middleware

@siangboon Yea that parts works fine as the middleware runs. I have confirmed this by dumping the response var to check if the headers are in there and they are, but the browser never gets them.

5 months ago
Activity icon

Started a new Conversation Setting Headers In Middleware

Just curious if something like this is still possible, as its not working.

reference : https://sujipthapa.co/blog/adding-custom-header-with-response-in-laravel

In a middleware, this is the code example.

public function handle($request, Closure $next)
        $response = $next($request);

        $response->header('Cache-Control', 'no-cache, must-revalidate');

        return $response;

If i dump the response before returning it, it does contain the headers. But, the headers dont seem to make it to the browser.

Any thoughts?

6 months ago
Activity icon

Replied to Type Hint Hell

I just wanted to post my solution, here also. (I posted the question at StackOverflow also, https://stackoverflow.com/questions/55593792/how-can-i-overwrite-a-php-function-that-has-a-argument-type-hint-set/)

namespace Original;

class ClassExtra {}

class ClassA {
    public function __construct($container, ClassB $classB) {}

class ClassB {
    public function __construct(ClassExtra $classExtra) {}

class ClassC {
    public $classB;
    public $containers;
    public function __construct(ClassB $classB) {
        $this->classB = $classB;
    public function container(string $container = 'default'): ClassA
        $this->containers[$container] = new ClassA($container, $this->classB);
        return $this->containers[$container];

Namespace Changes;

Class NewClassA extends \Original\ClassA {}
Class NewClassB extends \Original\ClassB {}
Class NewClassC extends \Original\ClassC {
    public function container(string $container = 'default'): \Original\ClassA
        $this->containers[$container] = new NewClassA($container, $this->classB);
        return $this->containers[$container];

$classC = new \Original\ClassC(new \Original\ClassB(new \Original\ClassExtra()));
/* string(15) "Original\ClassA" */

$classC = new NewClassC(new NewClassB(new \Original\ClassExtra()));
/* string(17) "Changes\NewClassA" */

I did the equivalent to the Orchestra\Assets package.

6 months ago
Activity icon

Started a new Conversation Type Hint Hell

Is what I’m trying to do possible?

I am trying to use orchestral/asset package, but I want to make some changes to the functionality in the Dispatcher class.

So this is the Orchestra\Asset\Service Provider:

  • register Resolver, ['orchestra.asset.resolver' => DependencyResolver]
  • register Dispatcher, ['orchestra.asset.dispatcher' => Dispatcher], with Resolver as a construct var
  • register Asset, ['orchestra.asset' => Factory], with Dispatcher as construct var

I copied the service provider, as i wanted to make a isolated copy of the class registrations.

The problem I'm having is I can't change the classe references as they have type hinted all the constructs with specific class references.

 * Create a new asset dispatcher instance.
 * @param \Illuminate\Filesystem\Filesystem  $files
 * @param \Collective\Html\HtmlBuilder  $html
 * @param \Orchestra\Asset\DependencyResolver  $resolver
 * @param string  $path
public function __construct(
        Filesystem $files,
        HtmlBuilder $html,
        DependencyResolver $resolver,
        string $path
    ) { ... }
 * Construct a new environment.
 * @param  \Orchestra\Asset\Dispatcher  $dispatcher
public function __construct(Dispatcher $dispatcher) { ... }

For example, I can't replace the Dispatcher in the Factory instantiation with my own class, as it always complains that is is not a instance of the Orchestra\Asset\Dispatcher class.

Is there any way around this ?

Or should I just fork the damn thing and str_replace the namespace make my changes and go on.

7 months ago
Activity icon

Started a new Conversation Kernel Class Differences?

Ok, so i am adding middleware in a package from my service provider, using the method described https://github.com/laravel/framework/issues/6211#issuecomment-106385763

// Register Middleware
$kernel = $this->app->make('Illuminate\Contracts\Http\Kernel');

So in my service provider i have the following:

 public function boot(Router $router, Kernel $kernel)
    // Add a new middleware to beginning of the stack if it does not already exist.

My question is whats the difference between using this as Kernel

use Illuminate\Contracts\Http\Kernel;


use App\Http\Kernel;

When #1 resolved to #2.


But when i use the #2 Kernel use statement my middleware does not get included.

Just curious if anyone could explain it.

1 year ago
Activity icon

Replied to Laravel Ldap Auth

@rob897 I've been working with that package but it seems to only work if I provide a admin username and password in the configuration, which I am not allowed to do.

1 year ago
Activity icon

Started a new Conversation Laravel Ldap Auth

Just curious if anyone knows of a package to authenticate to Active Directory, which does not require a admin user in order to validate if a user can login or not.

2 years ago
Activity icon

Replied to Laravel In Subdirectory Issues

I fixed this by adding the following to my nginx config for the phptesting.lan test site.

 location ~helpdesk/((.*)\.(?:woff2|woff|css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml))$ {
        rewrite helpdesk/((.*)\.(?:woff2|woff|css|cur|js|jpg|jpeg|gif|htc|ico|png|html|xml))$ /helpdesk/$1 break;

    location /helpdesk{
         rewrite ^/helpdesk/(.*)$ /helpdesk/index.php?$1 last;

I also updated the location block to the following

 location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_param REQUEST_URI $request_uri;
        fastcgi_param LARA_ENV local; # Environment variable for Laravel
        fastcgi_param HTTPS off;

        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;

2 years ago
Activity icon

Replied to Laravel In Subdirectory Issues

I've successfully install a laravel project in a sub-directory.

I think it is how the nginx is serving the pages.

Activity icon

Replied to Laravel In Subdirectory Issues

ok, i figured out the xampp issue. for some reason not all of the files were copied.

Activity icon

Started a new Conversation Laravel In Subdirectory Issues

Hi All, I have an odd problem.

I need to run Laravel 5.5 in a subdirectory.

I’m using Homestead and Xampp.

In homestead, when I navigate to http://phptesting.lan/subdirtest i’m redirected to http://phptesting.lan/subdirtest/install which is expected, however I receive the following error: No input file specified.

In the log, I see “Unable to open primary script: /home/vagrant/Code/phptesting/public/index.php (No such file or directory)” which is incorrect as it is missing the subdirtest

I’ve copied the project to XAMPP in windows 10 as I need to run it there too for demo. I get yet a different error.

Warning: require(C:\xampp\htdocs\subdirtest\helpdesk\vendor\composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\subdirtest\helpdesk\vendor\composer\autoload_real.php on line 66

I’ve double checked and mbstring is installed in XAMPP, in the phpinfo (Multibyte Support enabled)

Anyone have any ideas?

2 years ago
Activity icon

Replied to Paginate Weirdness


Here are the versions.

Laravel Framework 5.4.33

PHP 7.1.2-3+deb.sury.org~xenial+1 (cli) (built: Feb 22 2017 10:08:33) ( NTS )

Activity icon

Started a new Conversation Paginate Weirdness

Hi all, I'm working on a small helpdesk app for a school project and i've ran in to a weird problem.

I'm using a count of a relationship to get records that do not have a assigned tech.

When using the paginate, i dont get any data.

$tickets = Ticket::withCount("technicians")->where('technicians_count', 0)->paginate(5);

array:10 [▼
  "current_page" => 1
  "data" => []
  "from" => null
  "last_page" => 0
  "next_page_url" => null
  "path" => "http://helpdesk.lan/test"
  "per_page" => 5
  "prev_page_url" => null
  "to" => null
  "total" => 0

However, when i do the same query with a get i do receive data.

$tickets = Ticket::withCount("technicians")->where('technicians_count', 0)->get();

array:2 [
  0 => array:8 [
    "id" => 1
    "subject" => "Mouse issues"
    "contents" => "My mouse stopped working"
    "created_by" => "4"
    "status" => "UNASSIGNED"
    "created_at" => "2017-08-27 23:06:05"
    "updated_at" => "2017-08-27 23:06:05"
    "technicians_count" => "0"
  1 => array:8 [
    "id" => 4
    "subject" => "Software installed"
    "contents" => "I need acrobat reader installed to view PDF files."
    "created_by" => "4"
    "status" => "UNASSIGNED"
    "created_at" => "2017-08-27 23:06:05"
    "updated_at" => "2017-08-27 23:06:05"
    "technicians_count" => "0"

Any ideas?

2 years ago
Activity icon

Replied to Query With Dynamic Amount Of Joins

The only way I could get the joins to work was to change

$products = new Products;


$products = Products::select();

also, you have a type on the diameterxxx join - innert vs inner

hope that helps

2 years ago
Activity icon

Replied to How To Access Image From Storage File

Your going to need to make a special route to load the images out of the storage path and then use that route in your html image links.

some example code from a project that I have.

public function loadImage(...) {

// determine the file that needs to be loaded

// load the file in to a var
$manager = new ImageManager(\Config::get('image'));
$content = $manager->make($this->storageLoader->getFileFromStorage($cache_file, null));

// getFileFromStorage is return Storage::disk($disk)->get( $file  );

// make a response
return new IlluminateResponse($content->encode(), 200, array(
                'Content-Type' => $content->mime(),
                'Cache-Control' => 'max-age=' . (config('imagecache.lifetime') * 60) . ', public',
                'Etag' => md5($content)

Not exactly copy friendly, but you would need something similar to that. This is my route that i use for the url's

Route::get('/tome_image/{long_section_tag}/{year}-{month}-{day}/{zoom}-{page}.jpg', ['as' => 'tome_image', 'uses' => '[email protected]']);

you would need something in the route to determine what image file to load from the storage location.

Hope that helps.

2 years ago
Activity icon

Replied to Paginate How To Return All Rows But Start At Condition

The default is for the first paged result the prev_page_url is null and the last result next_page_url to be null

2 years ago
Activity icon

Started a new Conversation Auth Password Reset Not Working

Hey All, I have a problem with the default auth password reset in Laravel.

I have a brand new install with the auth installed.

I get the following error on the password reset when using the reset link that is emailed.

ErrorException in ResetPasswordController.php line 68: Undefined property: Illuminate\Support\Facades\Request::$email

The variable $email is not included in the url only a token which the route picks up.

Any ideas ?

2 years ago
Activity icon

Replied to Pagination On Array

take a look at https://laracasts.com/discuss/channels/laravel/is-it-paginate-available-collection it has a neat little helper function for paginating collections that might help

Activity icon

Replied to Read A Text File In And Parse It With Unicode Characters

not sure if it will work for what your wanting but i had some files that i needed to import which were utf8. I had to convert the file after I loaded the text.

I used this https://github.com/neitanod/forceutf8

Something like this...

$data = Storage::disk($disk)->get($file);
$data = Encoding::toUTF8($data);
$lines = preg_split("/\r?\n|\r/", $data);
2 years ago
Activity icon

Replied to How To Move All Files In Directory From One Filesystem To Another?

you need to have the full path to the file not the disk:path.

try something like...

// convert to full pathss
        $full_path_source = Storage::disk($sourceDisk)->getDriver()->getAdapter()->applyPathPrefix($sourceFile);
        $full_path_dest = Storage::disk($destDisk)->getDriver()->getAdapter()->applyPathPrefix($destFile);

// make destination folder
        if (!File::exists(dirname($full_path_dest))) {
            File::makeDirectory(dirname($full_path_dest), null, true);

        File::move($full_path_source, $full_path_dest);