Member Since 3 Years Ago

Gainesville, FL

Asst. In at UFL

Experience Points 72,680
Experience Level 15

2,320 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 655
Best Reply Awards 10
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.

05 Mar
1 year ago

gator left a reply on Using PHP Functions In View

I would just use a static function on a class - store the class in your psr-4 loaded space.

10 Feb
1 year ago

gator left a reply on Using SQL Views, Best Practices

I use views for reporting all the time.

You can use

return DB::table('view name')->get();

This way, you can avoid creating trivial models.

06 Feb
1 year ago

gator left a reply on To Display Logged In Username In Top Div.

what @wilk_randall said.. If security is important to you/your application then cookies should not be used to store anything except a session ID.

02 Feb
1 year ago

gator left a reply on How To Change Project Window Color To Match With Code Editor In PHPStorm 2017

Hmm.. looks like this project is discontinued too-

You can however, download the jar file from jetbrains repos and manually move it to: C:\Users\username\.PhpStorm2017.3\config\plugins

31 Jan
1 year ago

gator left a reply on How To Change Project Window Color To Match With Code Editor In PHPStorm 2017

I use "Color Tree" plugin.. works the same.

29 Jan
1 year ago

gator left a reply on Laravel 5.4 - How To Put File In The Database Directory

@wardaddy the error message still refers to your earlier code - using file_put_contents (DatabaseController line 25)

You are not yet using the code suggested by @jryd (which should work as expected).

27 Jan
1 year ago

gator left a reply on Laravel 5.5 For The Next 5 Years

Of course - use the latest and greatest when you start. Upgrades depend on your business need. If you have a single project that you are entirely responsible for (much like Laracasts/Forge), then it helps to be on the bleeding edge.

Otherwise, if you have a project built using an older version/framework that works well, it makes sense to continue maintaining it until it is no longer possible to do so. Clients are least bothered about the technology behind an app. I still maintain a couple of projects written using CodeIgniter! Upgrades/rewrites are not to be taken lightly especially for a heavily used system in production.

gator left a reply on Migrate From Zend Framework To Laravel

@DINESHKUMARBH "Migrating" the application is not feasible - The two frameworks are completely different. It will essentially have to be a "rewrite"...Create a blank laravel 5.5 project, then start with the routes file/ZF bootstrap and go from there.

If you have used good programming practices and separated your ZF code into modules/classes, it will make your job a little easier.

25 Jan
1 year ago

gator left a reply on Is There Any Server That You Would Recommend To Use With Laravel For Local Development?

I presume you mean on Windows?

This is the closest you can get to Laravel valet on windows :

I highly recommend it.

22 Jan
1 year ago

gator left a reply on 301 Moved Permanently

Hmm.. you seem to have followed all the instructions as described in the docs correctly (

What is the response when you uncomment dd($response) above?

If it still gives you an error, I would suggest you use your apikey and account_id, and try the call with postman (chrome extension)

gator left a reply on Dependency Injection - Getting A Handle On Drawbacks

Quite the opposite.

The goal of DI is to have a "central" place where dependencies are initialized - In Laravel, this is done within Service Providers using app()->bind() OR app()->singleton() OR app()->instance() - these methods bind a string "key" to an object "instance".

if you use DI properly, you will never have lines such as

$prod = new Product($dependency1, $dependency2);

peppered throughout your application.

Instead, you will have a single service provider where you have:

$this->app->bind('product', function ($app) {
    return new Product($dependency1, $dependency2);

This binds the string "product" to the object Product. Then, you can retrieve the fully constructed product either via automatic resolution (within controllers, routes and events) by including 'product' in functions/constructors.

Alternatively, you can manually resolve it (for example in unit tests) using:

$product = $this->app->make('product');

Hope this helps.

19 Jan
1 year ago

gator left a reply on New Application With 100's Of Form Fields

Your data is definitely structured. Using either KVP or JSON based representation could make data extraction needlessly painful. You may not have any relations (yet).. but obviously the data has business/decision value.

Personally, I would favor option 1.

  1. Implementation is simple and straightforward
  2. Mysql has a limit of 4000 odd columns per table.. but you could easily set up a one to one relation with another table if you approach this limit (highly unlikely)
  3. I would presume that down the line you would want to query (select and project) off of this data. This is where a relational database excels.
  4. Each piece of your data would have datatype associated with it. This would make filters easy to implement - For example when you have a field stored as a datetime, all records between a particular set of dates is trivial to select.

As far as implementation goes, you could, for example, have a "metadata" table that stores question_text, field_type, default_value, page_number (etc.). Render each form page based on the metadata table using macros for individual field types. This way, you will not need to type in html code for every single form field.

Hope this helps!

18 Jan
1 year ago

gator left a reply on Apache Can't Find Any Route That's Not The Home Page

Please look at both your error and access logs for more information.

They are usually at /var/logs/apache2/access.log and /var/logs/apache2/error.log. (Confirm using httpd -V)

17 Jan
1 year ago

gator left a reply on Hopefully Simple Collection Question

similar to @tykus solution.. but I think a bit more self explanatory:

$result = collect([1,2,3,4,5])->zip([6,7,8])->flatten()->filter()->all();
13 Jan
1 year ago

gator left a reply on Authentication Using Cookie Without Users Table

We use Shibboleth IAM for company wide authentication. After shib auth, users are returned to the laravel app with various server variables set.. I then follow the process as outlined by @Snapey to use Laravel auth semantics... Yes, you will have 1 user row per employee who accesses your site... I don't think you can avoid this (and honestly, it falls in the bucket of items which does not warrant any action).

07 Jan
1 year ago

gator left a reply on Update Two Tables At The Same Time

What is $user->id? Where is it set?

Your $user seems to be null after the find call, resulting in the error message (setting properties on a null php object) Also, this is a classic use case for database transactions.

06 Jan
1 year ago

gator left a reply on Which Session Driver Do You Recommend?

For most cases, the default (FileSessionHandler) should work just fine.

Unless yours is a high traffic site, I do not see why it should be 10MB.

If you look at the source code:

The gc() routine takes care of deleting files that are older than "lifetime" specified in your config/session. I'm guessing this is not running properly.. A permissions issue perhaps? More investigation is required. Set the 'expire_on_close' option to true (in config/session) to see if it alleviates the problem.

01 Jan
1 year ago

gator left a reply on How Can I Access Environment In View?

Do not put logic in the view. Instead, access the environment in the controller and pass it along to the view. More details here:

29 Nov
1 year ago

gator left a reply on Should We Concern About Choosing DMBS With Laravel?

Out of the box, Laravel provides "grammars" for sqlite, mysql, postgres and sql server This is to iron out the differences in SQL DML operations in these databases.

Eloquent builder uses one of these grammars to build up the necessary SQL (based on your config/env selections)

So, if you are strictly using Eloquent, you do not need to concern yourself with database differences; however, if you are using highly specific raw SQL in your code, then yes, you need to be mindful of the storage engine being used, and the corresponding sql syntax.

03 Oct
1 year ago

gator left a reply on Where Is 'php Artisan Tinker' In Lumen?


composer require laravel/tinker

Then, in bootstrap/app.php



22 Sep
1 year ago

gator left a reply on Image Intervention Usage PHP Laravel 5.4

You upload the picture using regular Laravel semantics:

Once this is done, and you have the real path of the uploaded file, you use intervention to manipulate the image...and overwrite if you wish.

14 Sep
1 year ago

gator left a reply on Return Next Item In Collection

Pure php solution (definitely 'faster'.. whether it is 'easier' is subjective):

$this_id = 123;
$id_array = array('349','430','123','423','113');

$flipped = array_flip($id_array);
$next_id = $id_array[$flipped[$this_id]+1];
06 Sep
1 year ago

gator left a reply on How Do I Generate An ID With Minimum Length Of 6?

A simple str_pad() call should do the trick:

$bookingID = str_pad($id,6,"0",STR_PAD_LEFT);
16 Aug
2 years ago

gator left a reply on How Do I Send Email To Multiple Recipients From A Single Email Form?

'explode' event->email into an array..

$recipients = explode(',', $this->event->email);

The mail to() function can then take this array of emails and dispatch.

14 Aug
2 years ago

gator left a reply on Ads Make Site Slow

@JeffreyWay , there is definitely an increase in ajax calls being made.

I can see lots of ad sites being contacted (in my status bar).. If you open your network bar, you can see... The issues seem to be caused by calls to:

08 Aug
2 years ago

gator left a reply on Factory Issue

As the error states, "save()" expects a model instance as parameter.

You want the "create()" method on the relation:

gator left a reply on Call To A Member Function GetClientOriginalName() On String

The file is not getting uploaded:

  1. Make sure you have enctype="multipart/form-data" on the input form.
  2. Check if file is, in fact, getting uploaded using:
if ($request->hasFile('image')) {
23 Jul
2 years ago

gator left a reply on Pagination And Parameters Other Than ?page=x

The internals about how '&' and '?' are added to the url is in the source code:

Yes.. using Request::except('page') is fine and it reduces maintenance ..i.e. if you add/delete query parameters, you do not have to change the pagination code.

22 Jul
2 years ago

gator left a reply on Pagination And Parameters Other Than ?page=x

"appends" literally appends the array that is passed in as parameter. So,


does what you need.

Now, the links() method already generates a "page" query string parameter. So, we need to exclude that when chaining to links(). Request::except('page') gives you an array of all the querystring parameters EXCEPT the page parameter.

i.e. when the url is

Request::except('page') returns


which is what you want to append.

03 Jul
2 years ago

gator left a reply on Struggling To Understand The Concepts Of Laravel And Frameworks, Can You Help?

If I were in your place, I would just learn the basics of laravel and recreate one of your projects using Laravel.

This will hopefully give you an appreciation of what Laravel brings to the table vs old vanilla php. Don't try to fight it.. these are all industry best practices and they are being widely used due to the benefits they provide.

If you are like me, as you use it more and more, lots of light bulbs will start going off in your mind and very soon, you will "see the light" :-) good luck!

14 Jun
2 years ago

gator left a reply on Forms In Blade (Solved)


 {{ Form::label('Week Ending') }} 
{{ Form::date('week_ending', null, ['id'=>'week_ending','minimum' => '2017-06-04', 'step' => '7'] )}}

06 Jun
2 years ago

gator left a reply on Equation In Laravel Where Condition

This is best handled by using a Stored Procedure.. Ideally, you want to keep "data related work" within the database. Read up on Stored procedures, query plans and query cache to learn more. Here's what a general solution would look like :

Step 1: create the SP on your server:

create procedure RowsWithinRadius
    lon double, 
    lat double, 
    radius double
    select * from coordinates_table where (abs(lon-longitude)/abs(lat-latitude)<=radius);

Step 2: Once the stored proc is in place, run a raw sql query from Laravel:

public function getRowsWithinRadius($lon, $lat, $radius)
    $results = DB::select( "call RowsWithinRadius($lon, $lat, $radius)");
03 Jun
2 years ago

gator left a reply on How Does Laravel Use The Session In Framework Itself

@Snapey, you are right. Web requests only. I missed the API group as I was looking at the source code of Laravel 5.0 :-)

gator left a reply on How Does Laravel Use The Session In Framework Itself

When in doubt, always go to the source.. Here is the starting point :

  1. In App\Http\Kernel, Global middleware Illuminate\Session\Middleware\StartSession is called (this happens for EVERY REQUEST)

  2. The constructor (StartSession class) instantiates the appropriate \Illuminate\Session\SessionManager based on your config settings (defaults to file)

  3. Notice comments inside the handle method of the StartSession middleware:

// Note that the Laravel sessions
// do not make use of PHP "native" sessions in any way since they are crappy.

And so on..

19 May
2 years ago

gator left a reply on Populate "old" In Controller

This is one of the main reasons, I continue to use LaravelCollective Forms. Form::model handles all this for you!

Throw in a bunch of combo/list boxes and/or check/radios, and plain html in the view can get hairy (esp. edit mode).

So, unless I am using a javascript framework, or dealing with a couple of simple textbox inputs in my form, I avoid plain html & "old()" in the interest of cleaner views.

01 May
2 years ago

gator left a reply on Know Password

Did you use bcrypt on top of the generated passwords? If so, you can't .. Salted hashes are one-way and cannot be reversed.

If you stored just the random string generated by faker::password, the generated string is the password.

25 Apr
2 years ago

gator left a reply on Compatibility Between Laravel Versions?

Yes.. unfortunately, API breakages between versions do happen more often than I like. As a side effect of this, getting online help (blogs, tutorials etc.) on something becomes tedious and error prone. Given that maintaining backward compatibility is not a priority at Laravel, I personally update the framework version on production code ONLY if I absolutely require a particular feature, AND I have a full test suite to back me up.

08 Apr
2 years ago

gator left a reply on Getting Video From Storage Directory

Another issue I noticed with having a "video" source to a route that contains:

//code for getting video from the storage directory
return Response::make($fileContents, 200); 

is that session info somehow gets deleted (i.e. user gets logged off automatically) - this happens randomly, further complicating troubleshooting :-(

Any insight on how this can be avoided? Placing the video files in "public" does not cause this.. but I would still like to serve my files from storage.

04 Mar
2 years ago

gator left a reply on For What Is The Local Storage?

Local storage is storage local to your file system, usually under the "app/storage" folder. It can be used for serving/receiving any type of file.

Consider for example, you have an application that stores users resume's. Now, you would not want to store documents directly in the public folder - because if you did, they can then be viewed by anyone on the internet (a web server will serve ANY file stored in the public directory completely bypassing the framework).

So, when the user uploads his/her resume, you move it into app/storage/resume folder. Then, based on your logic, authorization etc, you would create a route that returns response->download() or response->stream() from the storage folder.

I hope this helps!

03 Mar
2 years ago

gator left a reply on Using Scp To Download Files From Remote Server?

Tinker and exec run with your privileges, access to your stored keys etc.. this is not true when you run from browser or cron.

Have you tried ssh2_scp_recv ? (

06 Jan
2 years ago

gator left a reply on How To Work With Monolog-mysql ?

@dhaval , please refer to the source code of Monolog:

There is sample code in the comments.

05 Jan
2 years ago

gator left a reply on How To Work With Monolog-mysql ?

Laravel itself uses App::environment() for the context. Here's a link to the source code:

So, you could use

$logger = new \Monolog\Logger(App::environment());

A better approach would be to use the endpoint provided by laravel to extend monolog (using monolog-mysql):

NOTE: The creator of Monolog details why using mysql as the sink for logging is a bad idea: Be sure to review and take that into consideration.

01 Jan
2 years ago

gator left a reply on Database Engine Keeps Referring To Default Mysql.

I'm guessing you haven't changed/created environment variables (in your .env file).

In .env, create new vars (something like..):


and use those in mysql2 (database.php).

Hope this helps!

10 Dec
2 years ago

gator left a reply on Laravel5 + MS SQL Server + Linux

@fabiohvieira , You need mssql, freetds and pdo_dblib

22 Nov
2 years ago

gator left a reply on Reading Data From Mysql Views

Here's how I retrieve data from a view:

 $rows = \DB::select('select * from vw_MyView');
    foreach ($rows as $row) {
20 Nov
2 years ago

gator left a reply on Global Filter For POST Requests

There is an 'ismethod()' function on the request object that can detect post requests:

So, an outline for what you require can be:


namespace App\Http\Middleware;

use Closure;

class CheckBadwordsInPost
    public function handle($request, Closure $next)
        if ($request->isMethod('post')){
            if($this->hasBadWords($request->all())) {
                return redirect()->back()->with('error', 'Disallowed content found. Please Revise');;
        return $next($request);
    private function hasBadWords($formFields){
        foreach ($formFields as $field => $value) {
            //logic for detecting disallowed content here
            return true;
        return false;

Add this to the global middleware (web) Hope this helps.

19 Nov
2 years ago

gator left a reply on Static Or Not ?

Hmm.. Statics are generally hard to test using regular testing tools (phpunit for ex.)

Lets say you create a seemingly innocent static method like so:

public static int square($x)
    return $x*$x;

This is trivial to test .. just set up your expectation and assert that the square of the number is returned.. easy peasy.

Now, lets say you have another class/method, and within that you call :

$sqr = Class::square(10);

There.. now you have a problem on your hands! Unit testing a method that invokes a static can be problematic. Testing the above method in "isolation" requires use of other tools since there is no way to inject functionality (which would have been possible if you used an object to implement the same thing)

Hence the general guideline is to avoid statics in oop.