Member Since 1 Year Ago

Experience Points 9,460
Experience Level 2

540 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 89
Best Reply Awards 0
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.

26 Jun
3 weeks ago

ctyler left a reply on Are View Composers Only For Static Queries?

@DARKROAST - Brilliant! That's exactly what I needed.

 $params = Route::current()->originalParameters();
        // Dependencies automatically resolved by service container...
        //$this->users = $users;
        $studentsEnrolled = Enrollment::totalStudentsEnrolled($params['course']);
        $this->studentsEnrolled = $studentsEnrolled;

One thing for anyone looking this up after the fact. If you create a Service Provider for your view composers, be sure to execute: php artisan config:clear and php artisan clear-compiled Laravel did not recognize my service provider until after. Hopefully that will save someone some time!

Thank you.

ctyler started a new conversation Are View Composers Only For Static Queries?

I am rather new to View Composers so I am a little confused.

I am working on a training site. I have a view for classes that shows the number of students allowed, students enrolled and the number of sets remaining. I think that a View composer would be great for this but the problem is, in my limited understanding of composers, I cannot seem to figure out how to pass a variable to the view composer. Is this possible.

So for instance if the url ir /coursecat/1/course/1 Can I pass the Course ID into the View Composer?

Thank you!

13 Jun
1 month ago

ctyler left a reply on Issue Adding Days In A For Loop

@JOHNBRAUN - No problem! I appreciate the time and effort!

ctyler left a reply on Issue Adding Days In A For Loop

@johnbraun - Thanks, your the best. Heading over there now!

ctyler left a reply on Issue Adding Days In A For Loop

@snapey @johnbraun @mgsmus I have a question concerning this code. So, this is all happening inside the controller. Should i break this up into methods. So for instance, make the outer and inner for loops their own methods. And if so, would they go into their respective models or would it be better someplace else. I appreciate your thoughts on it.

ctyler left a reply on Issue Adding Days In A For Loop

So....I made some changes and the initial changes seem to indicate it is working

$courseDate = new Carbon($validated['start_date']);
for($i = 0; $i < $validated['no_classes'];$i++) {
                $course = Course::create([
                    'course_cat_id' => $coursecat->id,
                    'name' => $coursecat->name . ' : ' . $courseDate->format('Y-m-d'),
                    'start_date' => $courseDate->format('Y-m-d'),
                    'start_time' => $validated['start_time'],
                    'end_time' => $validated['end_time'],
                    'summary' => $validated['description'],
                $sessionDate = new Carbon($courseDate); // Make a new carbon object and copy it into session date before adding days. This is then used in second iteration. 
                $courseDate->add($validated['interval'], 'day');
                $attendance = Attendance::create([
                    'course_id' => $course->id,
                for($a = 0; $a < $validated['attendance_sessions'];$a++) {
                        'attendances_id'    => $attendance->id,
                        'session_starttime' => $validated['start_time'],
                        'session_endtime' => $validated['end_time'],
                        'session_date' => $sessionDate,
                    $sessionDate->add($validated['session_interval'], 'day');

Thanks everyone for your help. @snapey @johnbraun @mg

ctyler left a reply on Issue Adding Days In A For Loop

@SNAPEY - @snapey - I did not perceive that. Thank you, that helps.

12 Jun
1 month ago

ctyler started a new conversation Issue Adding Days In A For Look

Hello all, I am working on a training application. Trainers will need to take attendance for a course. So when generating course(s), admins can select: Start date, number of courses, Interval between courses, Number of session, Interval between sessions.

So each course will have an attendance object. Each attendance object will have one or more sessions. The problem I am having is the sessions and the dates.

$validated = $request->validated()
$no_courses = 0;
$courseDate = new Carbon($validated['start_date']); //Comes from the form
//The course for loop works great
for($i = 0; $i < $validated['no_classes'];$i++) {
                $course = Course::create([
                    'course_cat_id' => $coursecat->id,
                    'name' => $coursecat->name . ' : ' . $courseDate->format('Y-m-d'),
                    'start_date' => $courseDate->format('Y-m-d'),
                    'start_time' => $validated['start_time'],
                    'end_time' => $validated['end_time'],
                    'summary' => $validated['description'],
                $courseDate->add($validated['interval'], 'day');
                $attendance = Attendance::create([ //One attence object per course. this works
                    'course_id' => $course->id,
//So the number of session_date is the problem. Course can span multiple days and attendance will need to be taken every day (session).
                for($a = 0; $a < $validated['attendance_sessions'];$a++) {
                    $sesssionDate = $courseDate;
                        'attendances_id'    => $attendance->id,
                        'session_starttime' => $validated['start_time'],
                        'session_endtime' => $validated['end_time'],
                        'session_date' => $sesssionDate,
                    $$sesssionDate = $sesssionDate->addDays($validated['session_interval']); //This is not working in this for loop

So once this runs the Courses are created with the correct number of days between each course. The sessions, on the other hand, all have the same date which is the first course date when they are supposed to start on the first course created date and the session_interval between the rest of the sessions.

I hope I explained it clearly.

Any assistance would be appreciated.

07 Jun
1 month ago

ctyler left a reply on Nested Resource Controllers

@sirhxalot It was the camel case of the variable. Found it completely by accident. Changed it from $courseCat to $coursecat and boom! It worked. I cannot believe how much time I wasted on this, not to mention yours and @fraserk

My apologies for a silly mistake. So, my question is, does the variable have always be lower case or does it have to follow the case in the route - {coursecat}. My guess is that latter.

06 Jun
1 month ago

ctyler left a reply on Nested Resource Controllers

I will try that first thing in the AM.

ctyler left a reply on Nested Resource Controllers

@sirhxalot - The model? Yes. I do have an ID in my migration:

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCourseCategoriesTable extends Migration
     * Run the migrations.
     * @return void
    public function up()
        Schema::create('course_categories', function (Blueprint $table) {

     * Reverse the migrations.
     * @return void
    public function down()

ctyler left a reply on Nested Resource Controllers

@sirhxalot That is exactly what I have:

class CourseCat extends Model
    use Sortable;
    public $sortable = [

   // protected $dates = ['start_date', 'end_date'];

    protected $fillable = [
        'name', 'description', 'start_date', 'end_date', 'assignments_no', 'seats', 'wait_lists', 'certificates', 'attendance_sessions'
    protected $table = 'course_categories';

    public function courses()
        return $this->hasMany('App\Courses');

ctyler left a reply on Nested Resource Controllers

@fraserk There is no pivot table. That is the name of the course category table. However, could the naming convention be an issue?

ctyler left a reply on Nested Resource Controllers

@sirhxalot, I believe I did when I set it up. I believe that simply puts the type hinting as a parameter on your actions

ctyler left a reply on Nested Resource Controllers

Hi @sirhxalot The model says false for exists. However, I added the id to the dd()

{{ dd($courseCat->id) }}

It is returning null.

ctyler started a new conversation Nested Resource Controllers

I am having difficulty with nested resource controllers. If I have a resource controller:

Route::resource('coursecat.course', 'CourseController');

That give me these routese (via php artisan route:list) I get the following routes:

admin                                                    |                          | Closure                                                                     | web                                 |
|        | POST      | admin/coursecat                                          | coursecat.store          | App\Http\Controllers\Admin\[email protected]                        | web                                 |
|        | GET|HEAD  | admin/coursecat                                          | coursecat.index          | App\Http\Controllers\Admin\[email protected]                        | web                                 |
|        | GET|HEAD  | admin/coursecat/create                                   | coursecat.create         | App\Http\Controllers\Admin\[email protected]                       | web                                 |
|        | PUT|PATCH | admin/coursecat/{coursecat}                              | coursecat.update         | App\Http\Controllers\Admin\[email protected]                       | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}                              | coursecat.show           | App\Http\Controllers\Admin\[email protected]                         | web                                 |
|        | DELETE    | admin/coursecat/{coursecat}                              | coursecat.destroy        | App\Http\Controllers\Admin\[email protected]                      | web                                 |
|        | POST      | admin/coursecat/{coursecat}/course                       | coursecat.course.store   | App\Http\Controllers\Admin\[email protected]                           | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}/course                       | coursecat.course.index   | App\Http\Controllers\Admin\[email protected]                           | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}/course/create                | coursecat.course.create  | App\Http\Controllers\Admin\[email protected]                          | web                                 |
|        | DELETE    | admin/coursecat/{coursecat}/course/{course}              | coursecat.course.destroy | App\Http\Controllers\Admin\[email protected]                         | web                                 |
|        | PUT|PATCH | admin/coursecat/{coursecat}/course/{course}              | coursecat.course.update  | App\Http\Controllers\Admin\[email protected]                          | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}/course/{course}              | coursecat.course.show    | App\Http\Controllers\Admin\[email protected]                            | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}/course/{course}/edit         | coursecat.course.edit    | App\Http\Controllers\Admin\[email protected]                            | web                                 |
|        | GET|HEAD  | admin/coursecat/{coursecat}/edit                         | coursecat.edit           | App\Http\Controllers\Admin\[email protected]

In my CourseController, for my index() action, I have:

public function index(CourseCat $courseCat)
        return view('admin.course.index', compact('courseCat'));

In my admin.course.index view I have

{{ dd($courseCat) }}

So, if I visit I would expect to see the output of CourseCat object with the ID of 10. However, it is returning:

CourseCat {#458 ▼
  +sortable: array:2 [▶]
  #fillable: array:9 [▶]
  #table: "course_categories"
  #connection: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: false
  +wasRecentlyCreated: false
  #attributes: []
  #original: []
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #guarded: array:1 [▶]

I am not sure why that is not working. Does route model binding not work with nested controllers. Is there something I need to do special for nested controllers.

Any help would be appreciated.

15 May
2 months ago

ctyler left a reply on Telescope Not Logging Registered Event

I was just doing some more research on this. Apparently internal events are ignored - per the documentation:

Event Watcher The event watcher records the payload, listeners, and broadcast data for any events dispatched by your application. The Laravel framework's internal events are ignored by the Event watcher.

ctyler left a reply on How To Create Custom Email Verification Template | Laravel 5.7


It looks like you can access the users details because the event is called from the user in vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php

class SendEmailVerificationNotification
     * Handle the event.
     * @param  \Illuminate\Auth\Events\Registered  $event
     * @return void
    public function handle(Registered $event)
        if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) {

I am assuming that means you can personalize the email? How would you access the user detail from the emails.verify markdown?

P.S. I just asked this question before I seen this post, sorry.

ctyler started a new conversation Telescope Not Logging Registered Event

So I am using Telescope for testing and troubleshooting.

When a person registers they are to select an employer form a drop down. The employer is to get an email so they can log in and verify that that person was in-fact hired by them. I need to be able to fire an email off to the employer notifying them they have a new employee register and they need to approve it.

So I go into the EventServiceProvider.php and see:

protected $listen = [
        Registered::class => [

I see the event Registers and its listener, however there is no Event or Listener folders in app/. That is not surprising, however, what is surprising is telescope is not picking up the Event Registered when the email verification is mailed. Telescope picks up that but not the event itself and therefore not the listener either.

I heard of logging being effected if the APP_ENV is not local. Mine is local.

Any help in this area would be appreciated.

ctyler started a new conversation How To Modify/Personalize Email Verification Email

Good Morning, I am having an issue with customizing the email verification email. I have seen a few work-arounds that seem clumsy to me and uncharacteristic of what I have seen so far from laravel. I would like to use a custom markdown that I can pass the user to so I can personalize the email. Is there a way to do this and if so, what is the best way to do this?

Thanks in advance Casey

26 Apr
2 months ago

ctyler started a new conversation Modify Migration File For MSSQL Datatype

Good after noon. I am using MSSQL with a laravel application. When retrieving a date from the database I am getting a carbon error. This is basically due to the format that MSSQL uses. This is corrected by adding:

protected $dateFormat = 'Y-m-d H:i:s';

to the model and updating the date columns to datetime2.

Everything works correctly after that. My problem is the migrations. Is there a way I can update this in the migrations file so when I do something like migrate:refresh I don't have to modify my columns to change them to the datetime2 format? I want to change $table->timestamp('created_at') ; to something like $table->datetime2('created_at'):

Any help would be appreciated.

19 Apr
1 year ago

ctyler left a reply on Cannot Use Migrate With MSSQL, WAMP, And 7.1 Server On Local Machine

Snapey, you are awesome my friend. I had the correct dll file noted in one php.ini file but not the other. Once that was fixed I had some permission errors that were fixed easy enough. Thank you for your time. I really appreciate it.

17 Apr
1 year ago

ctyler started a new conversation Cannot Use Migrate With MSSQL, WAMP, And 7.1 Server On Local Machine

Hello, WAMP: 3.1.0 64 bit PHP: PHP 7.1.9 LARAVEL: 5.6 SQL_SERVER: Microsoft SQL Server Developer (64-bit)

I set up all of the info in .env correctly: DB_CONNECTION=sqlsrv DB_HOST= DB_PORT=1433 DB_DATABASE=test_database DB_USERNAME=test_user DB_PASSWORD=test_pass

When I go to GIT Bash and Execute php artisan migrate i get:

Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)

at C:\wamp64\www\laravel-adldap2-test\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {

664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|

Exception trace:

1 PDOException::("could not find driver") C:\wamp64\www\laravel-adldap2-test\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68

2 PDO::__construct("sqlsrv:Server=,1433;Database=test_database", "test_user", "test_pass", []) C:\wamp64\www\laravel-adldap2-test\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:68

Please use the argument -v to see more details.

A couple of points to keep in mind.

  1. I can connect to same DB with other application 2)I can connect to this data base with this application

If I create a view and route and add this to the view:

try { $conn = new PDO("sqlsrv:Server=,1433;Database=test_database", "test_user", "test_pass"); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $ex) { echo $ex->getMessage(); }

if($conn) { echo "Connection worked"; } else { echo "No joy"; }

This echos "Connection Worked"

Is there anything else I can check? Has anyone ran into this?

Thank you Casey