clay

clay

Member Since 5 Years Ago

Irving, TX

Experience Points 90,775
Experience Level 19

4,225 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 682
Lessons
Completed
Best Reply Awards 57
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

15 Mar
1 year ago

clay left a reply on Zend Bar

Checkout this issue on the homestead repo.

clay left a reply on Loading The Wrong Page

These two routes are the same:

Route::get('/posts/{create}', '[email protected]');

Route::get('/posts/{post}', '[email protected]');

Why is 'create' inside {}?

Maybe:

<?php 

Route::get('/', '[email protected]');

Route::get('/posts/create', '[email protected]');

Route::get('/posts/{post}', '[email protected]');

Route::post('/posts', '[email protected]');
27 Oct
1 year ago

clay left a reply on Pi (π) Button

super + shift + click

17 Oct
1 year ago

clay left a reply on Tinker : ErrorException : Directory Not Empty

i know this doesn't help, but I just started having the same problem.... Investigating...

19 Sep
1 year ago

clay left a reply on Can Somebody Tell Me How To Host Laravel Project.. I Talked With Many Hosting Compnay

Google "Laravel shared hosting". There are many blog posts that tell you step-by-step how to do it. Some are a couple of years old, but still should contain relevant information.

14 Sep
1 year ago

clay left a reply on Having Trouble To Set Up Auto-discovery For A Facade

I tried loading your package to test, but packagist is on 0.0.3 which doesn't include the "laravel" key in composer.json for auto-discovery.

13 Sep
1 year ago

clay left a reply on Roles And Permissions In Native Laravel

In the past, I've used a couple of different packages for this, but recently, I've found that it isn't very difficult to implement and you'll have much more control if you do it yourself. Jeffrey has a video that may help: Roles and Permissions Here is the github repo for that video.

The video is for Laravel 5.1, but it should still get you started.

clay left a reply on How To Make A Custom FormRequest Error Response In Laravel 5.5

From the upgrade documentation:

A Note On Form Requests

If you were customizing the response format of an individual form request, you should now override the failedValidation method of that form request, and throw an HttpResponseException instance containing your custom response:

use Illuminate\Http\Exceptions\HttpResponseException;

/**
 * Handle a failed validation attempt.
 *
 * @param  \Illuminate\Contracts\Validation\Validator  $validator
 * @return void
 *
 * @throws \Illuminate\Validation\ValidationException
 */
protected function failedValidation(Validator $validator)
{
    throw new HttpResponseException(response()->json(..., 422));
}

clay left a reply on Vue Interpolation

<h1>@{{ $text }}</h1> or

@verbatim
    <h1>{{ $text }}</h1>
@endverbatim

clay left a reply on Forums

There's a 77 episode series here on laracasts on how to build a forum.

21 Jun
1 year ago

clay left a reply on Loading Package Assets (css/js) Into The View NOT Using Artisan Publish

Also, I was just reading up on the package auto-discovery coming to Laravel 5.5 and it looks like it only affects adding the service provider and facade. Looks like users will still have to publish any assets. My apologies for misleading you.

19 Jun
1 year ago

clay left a reply on Loading Package Assets (css/js) Into The View NOT Using Artisan Publish

It would probably help to have a look at some other laravel packages similar to yours to see how it is handled. It's really hard to say, not knowing your package. There are many options based on what you're trying to accomplish. Depending on the scope of the package maybe a separate frontend package would even be an option. Otherwise, for a backend php composer package, it doesn't seem like you would want to be providing a lot of javascript or css and probably shouldn't be updating it very often. Like I said though, it's hard to say. There are so many different situations that would be handled differently.

18 Jun
1 year ago

clay left a reply on Loading Package Assets (css/js) Into The View NOT Using Artisan Publish

For package specific views and assets, that is the purpose of publish. In framework agnostic applications, packages that provide views and assets, require the end-user to copy/paste assets to their app directory, or use some programmatic alternative solution. Laravel provides the 'publish' command as a convenience to the user.

Laravel Publish Package Assets

On the other hand, when dealing with config files, these are usually only copied when the user needs to customize. The config settings can be used from within the package, so the package author can set reasonable defaults. Assets and views are different.

Last, Laravel 5.5, due out by the end of July, has implemented 'auto-discovery' for packages. This allows the package author to add a few lines to their composer.json file and when the package is installed, assets, views, migrations, config, etc. can all be automatically published. For now though, your README just needs to be thorough in defining the installation steps, including publishing assets.

clay left a reply on Some Issues With Laracast And The Popular Course Here On Laravel

Anyone that can come here touting Udemy is suspicious from the start. Udemy facilitates for-profit, stolen education. They are an example of how not to run a tech ed. site.

There are ~1000 videos on the site with endless discussion of each. You signed up, watched one episode of 50 episode series and then wrote a critique of the entire Laracasts business.

If you want to know the tools, there are many series' here about that. "How to Build a Forum" is an advanced series in which it is assumed you know the fundamentals of developing with modern PHP.

13 Jun
1 year ago

clay started a new conversation Prevent Javascript Package From Pulling In Jquery

javascript 101 i'm sure, but I'm not having any luck. In my resources/assets/js/app.js:

require('the-package')

in my webpack.mix.js:

mix.js('resources/assets/js/app.js', 'public/js');

now, when I 'npm run dev', the public/js/app.js is created as it should be, however, since 'the-package' depends on jquery, and jquery is available in my node_modules, it is automatically pulled in and added to public/js/app.js. I want to simply prevent jquery from being automatically pulled in. Of course, my setup is much more involved than this, but I stripped it down to this one problem. Any pointers?

Thanks

09 Jun
1 year ago

clay left a reply on Calculate Age From Birthday

with Carbon, you can call 'age'

var_dump(Carbon::createFromDate(1977, 1, 15)->age);

or since Laravel can convert your dates to Carbon instances

var_dump($user->birthdate->age);
18 May
1 year ago

clay left a reply on MySQL Requires TEXT Fields To Have A Default Value In Strict Mode??

I usually see this error when I forget to mark a field as 'nullable' in the db. If you're using laravel migrations, then:

$table->text('foo')->nullable();
09 May
1 year ago

clay left a reply on Always Returning App\User

If you're extending a User model in a package, you shouldn't change your model in config.auth. Your model is still App\User, it just has a parent. Also, the packages' User model, theoretically, should extend Authenticatable.

clay left a reply on Error On Vagrant Ssh In Homestead, User Directory With Whitespaces

have you tried using quotes in your config

folders:
    -
        map: 'C:\Users\John Doe\code'
        to: /home/vagrant/Code
28 Apr
1 year ago

clay left a reply on Removing Route

The 'home' that is showing in your route:list, isn't referring to the name of the view. Can you show your entire routes file.

clay left a reply on Laravel Mix Put All Js Code Inside App.js

checkout this page on the mix documentation

clay left a reply on Code After Middleware

using the middleware closure in your controller constructor, you can get the current user and use it in your action methods:

//HomeController.php
<?php

namespace App\Http\Controllers;

class HomeController extends Controller
{

    private $user;

    public function __construct()
    {
        $this->middleware(function($request, $next) {
            $this->user = auth()->user();
            $response = $next($request);

            return $response;
        });
    }

    public function index()
    {
        dd($this->user);
    }

}
26 Apr
2 years ago

clay left a reply on Code After Middleware

Sounds like the job of a custom middleware. Maybe instead of calling $this->middleware('auth');, just create a new middleware that combines the auth logic with your custom logic and use that instead. Another option would be to leave the auth middleware then add a second middleware using a closure like:

$this->middleware(function ($request, $next) {
    // ...

    return $next($request);
});
07 Apr
2 years ago

clay left a reply on How Can I Set My Laravel Files To Sending Mails To All Clients . (Universal)

mailtrap is just for catching all emails during development. to actually send email, either sign up with a client like sendgrid, mandrill, mailgun, or alternatively, use your gmail. Just search this forum for "send mail with gmail" and you'll find lots of answers.

06 Apr
2 years ago
02 Apr
2 years ago

clay left a reply on Event.$on Runs Its Callback Function When The Componenet Is Created, Despite The $emitter Has Not Emitted Any Event

I'm thinking maybe the alert should be wrapped in a function?

created () {
    Event.$on('login', function() {
        alert('am handling')
   })
}
28 Mar
2 years ago
27 Mar
2 years ago

clay left a reply on [Socialite] How To Handle Providers That Don't Return The Email

For sites with social integration, I usually don't ask the user for any information. I use a one-click registration and login. However, I do ask them to confirm the registration information before adding the user to my db(In case someone else was logged into a social site and they didn't realize it). So, if the user doesn't exist and their email wasn't returned with the socialite object, I also show, along with the returned information, a single-input form for their email address. They can confirm the returned info and add their email address at that point. It may not be ideal, but it's still pretty simple.

24 Mar
2 years ago

clay left a reply on Route Model Binding Produces 404, Even Though Route Exists

Check out the docs on this.

You're placeholder must match the method parameter and it must be type-hinted for the model. So if I wanted to use route model binding for showing a single user:

//web.php
Route::get('/myapp/user/{user}', '[email protected]');
//UsersController.php
public function show(User $user)
{
    dd($user);
}

clay left a reply on Include VueJS With Webpack

If you want to be able to just call "Vue" from any javascript file, you'll need to

window.Vue = require('vue');

instead of

Vue = require('vue');

if you do the latter, then you'll need to do that in every file in which you want to reference Vue. Or you could setup autoloading for Vue. There are many different options for this.

Of course this all depends on Vue being available in your node_modules directory.

19 Mar
2 years ago

clay left a reply on How Can I Submit Code Improvement Of Laravel To Taylor?

I don't know if it was clear, but the laravel project that is installed that requires your framework branch as a dependency, is for testing your changes. Of course, you would need to add/push/commit, etc., from within your framework fork directory. Do not run these git commands from within your testing laravel project directory.

clay left a reply on How Can I Submit Code Improvement Of Laravel To Taylor?

Checkout this blog post by @mattstauffer. It explains the process of forking, cloning, making changes, pushing, etc.

If you're completely new to this, the following may be overwhelming, but maybe it will help someone that's trying to figure this stuff out.

  1. Visit the Laravel Framework repo on Github.
  2. Click the 'Fork' button. This will create a repo under your account of the Laravel Framework.
  3. Go to your forked repo's page on your Github and click the "Clone or Download" button.
  4. Copy the .git link that appears, to your clipboard.
  5. Open your terminal and go to the parent directory where you keep your projects (or a location of your choosing).
  6. In your terminal, run the command git clone THE_LINK_THAT_YOU_COPIED
  7. cd into the newly created folder ("framework")
  8. Back in your browser, go to the main Laravel Framework repo on github and click the "Clone or Download" button.
  9. Copy the .git link that appears, to your clipboard.
  10. Back in your terminal, run the command git remote add THE_LINK_THAT_YOU_COPIED
  11. Determine which branch you want to target. For new-major features, this would be "master", for bug fixes/minor-non-bc-break-features, this would be the latest stable version "5.4".
  12. In your terminal, run the command git checkout THE_BRANCH_YOU_ARE_TARGETING.
  13. Run the command git fetch upstream
  14. Run the command git merge upstream/THE_BRANCH_YOU_ARE_TARGETING
  15. Run the command git push origin THE_BRANCH_YOU_ARE_TARGETING
  16. Decide on a name for the branch you will be using to develop the feature/bug fix.
  17. Run the command git checkout -b YOUR_NEW_BRANCH_NAME
  18. Now you are ready to make your changes to the code, but before we go on, you need to setup a laravel project in which you use your branch as a dependency.

Prepare a laravel project to use your branch of the framework

  1. In your terminal, go to the parent directory where you keep your projects(or a location of your choosing) and run the command laravel new my-new-feature. Then cd into that folder.
  2. If targeting the next release("master"), there maybe inconsistencies between the latest laravel application and laravel framework, so you may want to use the dev version of the application when you spin up your project (Never done this myself, I always use the current application).
  3. In the composer.json folder of your application, you'll need to make changes to target your branch.
  4. At the bottom of the composer.json, add the following block(be sure all blocks are separated by a comma:
 "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/your_username/framework"
        }
    ]
  1. In the 'require' block of composer.json, change the following line
"laravel/framework": "5.4.*",

if you're targeting master, change to

"laravel/framework": "dev-master",

if you're targeting the latest stable, change to

"laravel/framework": "dev-5.4",
  1. Save the file and from inside the project root, run composer update
  2. Now your project should be using your forked branch

Resume steps from above

  1. Make the changes necessary to introduce the feature or fix the bug.
  2. add/commit the changes
  3. run the command git push origin YOUR_NEW_BRANCH_NAME
  4. Go to your repo page and there should be a green button that says "Compare and Pull request". Click this button and follow the instructions to Add a title and description.
  5. Once you submit the pull request, a couple of tests will automatically run to make sure there are no conflicts and make sure there are no style issues.
  6. If changes are required, use your editor to make these changes, then add/commit/push.
  7. If you end up with a lot of additional small commits that fix style problems, etc., it may be best to squash your commits into one.

Squash your commits down to one

  1. Decide how many commits need to be squashed
  2. Run the command git rebase -i HEAD~4 (where 4 is the number of commits that have been made)
  3. An editor will appear that looks similar to the following:
pick 01d1124 adding my new feature
pick 6340aaa style fixes
pick ebfd367 style fixes
pick 30e0ccb a small refactor

# Rebase 60709da..30e0ccb onto 60709da
#
# Commands:
#  p, pick = use commit
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
  1. Leave the word "pick" on the first commit, but on the subsequent lines, change "pick" to "squash", then save and exit the editor.
  2. Another file will appear in the editor, giving you the opportunity to change the commit messages. I usually leave this as-is and save and exit the editor.
  3. run the command git push origin YOUR_NEW_BRANCH_NAME -f (be sure to add the "-f")

I know this is a lot of info and I'm sure people have many different ways to do this, but this is my workflow. There should be enough info there to get you started. Depending on your OS, things may work a little differently but everything should still apply.

Be sure everything works as expected before actually submitting the PR. If something goes wrong with git along the way and you can't work your way out of it, it's no big deal. You can safely delete your local and remote repos and start the process over.

Finally, be prepared for blunt/honest feedback, that is sometimes brief, on your pull request. There are only a few people watching these PRs and only Taylor actually merges.

I'll read back through in case I missed something or typed something wrong.

18 Mar
2 years ago

clay left a reply on Use Dropzone With Laravel

If you have a paid account here at laracasts, jeffrey actually covers dropzone in one of the videos from Build Project Flyer with Me. Not sure exactly which video, but probably one of the ones related to forms.

clay left a reply on How To Edit Node Modules?

If you're using charliekassel/vuejs-datepicker, check the issues on the repo. Looks like several people have asked similar questions. charliekassel/vuejs-datepicker If that's not the one you're using, be sure to check the issues section of the repo. Likely, there's a prop you can pass for the css class.

clay left a reply on ConvertEmptyStringsToNull Not Working With Vue

With the new middleware added in 5.4, there were some issues that came up with validation rules that had worked in previous versions. I just know that I've seen this come up in the framework repo issues several times and this is the answer that is given each time. ¯_(ツ)_/¯

17 Mar
2 years ago

clay left a reply on Axios Get Data

Did you make a typo in your function when you typed it in your question? If not, it has an error.

fetchData(){
    axios.get('/api/orig').then( (response) => {
        this.origs = response.data
        alert(this.origs)
    }
}
``
Note the big arrow inside the 'then'.

Also, if you're trying to alert below the axios.get call, then you're alerting before the ajax call finishes and therefore original hasn't been set yet.

clay left a reply on ConvertEmptyStringsToNull Not Working With Vue

Add nullable to your validation rules:

$rules = [
    'website' => 'url|nullable'
];
12 Mar
2 years ago

clay left a reply on User To User Relationship

Here's a generic summary of what is needed for your situation. The example is a little old, but should still apply. Laravel - User Friendships

A Friend_user model isn't necessary. The relationships are defined on the User model. It IS possible in Laravel 5.4 to define a custom pivot model, but it is unnecessary in this case.

clay left a reply on User To User Relationship

if you want timestamps on your pivot table, just make sure your migration has $table->timestamps() and in your relationship methods, add 'withTimestamps'. e.g.

$this->belongsToMany('User')->withTimestamps();

clay left a reply on Laravel 5 Suggest The Pagination Don't Hard Coding The Ul Tag By Default

Check out the laravel docs. Is this what you mean? You can publish the views then customize however you wish.

clay left a reply on Why Login Page Still Showing On Footer After I Logged In On Laracasts.com?

Just a simple oversight, doesn't really cause any problems. @JeffreyWay

clay left a reply on New Blade Files Showing 404 Error

When you say "I navigate to the file", how are you doing this? Can you show your routes file and/or the associated Controller & method?

If you have 'trades.blade.php' in the root 'views' folder, then at the least, you'll need a route in your 'routes\web.php' file. e.g.

<?php


Route::get('/trades', function(){
    return view('trades');
});

or using a controller:

//routes/web.php

<?php

Route::get('/trades', '[email protected]');
//App\Http\Controllers\TradesController.php
<?php

namespace App\Http\Controllers;


class TradesController extends Controller
{

    public function index()
    {
        return view('trades');
    }
}

clay left a reply on Must Be An Instance Of Facades\Validator, Instance Of Validation\Validator Given

You shouldn't be passing a facade to a constructor and assigning it to a property. Facades are designed to be used directly. just

<?php

namespace App\Http\Controllers;

use Validator;

class MyController
{
    public function store
    {
        $validator = Validator::make($request->all(), [
            'title' => 'required|unique:posts|max:255',
            'body' => 'required',
        ]);

        if ($validator->fails()) {
            return redirect('post/create')
                        ->withErrors($validator)
                        ->withInput();
        }
    }
}

or, in your controllers, if you're extending the base controller, you can just use the $validate method that is provided via the ValidatesRequests trait. e.g.

public function store(Request $request)
{
    $this->validate($request, [
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ]);

    // Validation passed, store in database...
}
08 Mar
2 years ago

clay left a reply on Retrun Value In 'getFacadeAccessor' Method

you were using an alias in your binding but you were referencing, through the interface, the actual class. Laravel didn't know that when you asked for a VimeoVideoService, that you wanted the 'vimeo_video_service'

clay left a reply on Retrun Value In 'getFacadeAccessor' Method

just replace the string that you are using to identify the class in the binding with the string representation of the class itself, ``` 'App\Services\Video\VimeoVideoService'

instead of 

vimeo_video_service

Then, if you still need to refer to the service via the ```vimeo_video_service``` string, you can bind an alias to App\Services\Video\VimeoVideoService

clay left a reply on Retrun Value In 'getFacadeAccessor' Method

if you're using an interface as a parameter in your constructor, then you need to bind an implementation to it. e.g.

public function register() {
    $this->app->bind('App\Services\Video\Contracts\VideoServiceInterface', ''App\Services\Video\VimeoVideoService');
    
    $this->app->singleton('vimeo_video_service', function($app) {
        $vimeo = new Vimeo(
            config('services.vimeo.client_id'),
            config('services.vimeo.client_secret'),
            config('services.vimeo.access_token')
        );

        return new VimeoVideoService($vimeo);
    });
}

Not sure about the other error...

07 Mar
2 years ago

clay left a reply on Deleted Views File

is this a specific editor that you're right-clicking, or an OS feature, or a git desktop application, or .....

03 Mar
2 years ago

clay left a reply on Webpack And Bootstrap

or you can copy the bootstrap fonts from the node_modules folder over to where it is looking for them:

/home/mark/Code/ena-shaw/es-admin/application/src/css/fonts/bootstrap

clay left a reply on Php Artisn Serve

Sounds like you may have an infinite loop in your code. Some operation is taking too long. Are you using version control? It would be good if you could switch to another branch and test. You need some way to narrow down where the bad code is located. Is there any additional info in the laravel logs?