Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

Jaytee

at Student at Ara Institute

Experience

103,675

108 Best Reply Awards

  • Member Since 2 Years Ago
  • 418 Lessons Completed
  • 2 Favorites

13th December, 2017

Jaytee left a reply on 404 Response For "webhook/stripe" Url For Test Domain? • 8 hours ago

You updated the webhook URL in stripe to point to the actual domain? And of course, set stripe keys to live keys instead of test keys?

Jaytee left a reply on Is It Worth Javascriptifying The Front-end? • 9 hours ago

I use Javascript if i can, it makes the website more lively. And it's always great when you don't need to wait for the page to refresh, especially if the server is slow. I find it much better looking at a loading icon rather than the browser going nuts trying to load stuff.

Jaytee left a reply on Laravel - Action App\Http\Controllers\post-show Not Defined • 9 hours ago

The action is used to call a controller method, not a named route. Whenever you use the as array key or name() method on a route, it becomes a named route, not an action.

The action method would be something like action('[email protected]').

@jorpedito The second parameter for the route method isn't required to be an array as there is only one wildcard

Jaytee left a reply on Is It Worth Javascriptifying The Front-end? • 9 hours ago

I don't usually ajax a forum thread, because it's not really a live chat where users are constantly commenting. But ajaxing won't make the replies show without refreshing, unless you're polling the server for new replies or using sockets.

It's entirely up to you whether you want to add live functionality, in some cases it's definitely beneficial, in others, not so much, but more of a nice feature.

Jaytee left a reply on Laravel - Action App\Http\Controllers\post-show Not Defined • 9 hours ago

The error is with this:

<a href="{{ URL::action('post-show', $post->slug)}}">{{$post->title}}</a>

Change it to this:

<a href="{{ route('post-show', $post->slug) }}">{{$post->title}}</a>

Jaytee left a reply on Moved From BS3 To BS4 - Problem W. Spacing Between <NAV> And <MAIN> • 12 hours ago

It's just the way it is. I mean, a simple solution would be to just add spacing by yourself??

28th November, 2017

Jaytee left a reply on Problem With Installing Laravel • 2 weeks ago

Make sure you're actually installing the whole of Laravel through composer, and not just copying the composer.json file into an empty folder.

either install through the laravel installer and then run laravel new someappname

or install directly through composer composer create-project laravel/laravel someappname

18th November, 2017

Jaytee left a reply on Crudbooster::admin_template • 3 weeks ago

What does this mean? https://laravel.com/docs/master/packages#views

Read that. Try reading the docs, multiple times i've seen you not even bother to try read the docs or actually learn PHP now. We're here to help, not build your whole app.

I cannot find where the admin_template is?

Look in the vendor folder and look for a crudbooster folder. It should be in there. Or see if you can publish any assets using php artisan vendor:publish and look for crudbooster

17th November, 2017

Jaytee left a reply on Undefined Variable: Forum • 3 weeks ago

Yeah since you passed the $forums variable to index.blade.php, it means that post.blade.php doesn't have access to it.

What you need to do in index.blade.phpis include post.blade.php

@extends('layouts.main')


@section('content')

<div class="container">
   @include('forum.includes.post')
</div>

@endsection

The better way to do it would be to remove the foreach loop from the post.blade.php:

@extends('layouts.main')


@section('content')

<div class="container">
    @foreach($forums as $forum)
        @include('forum.includes.post')
    @endforeach
</div>

@endsection

Then you would just use the $forum variable in forum.includes.post view.

Jaytee left a reply on Undefined Variable: Forum • 3 weeks ago

@blueshift9 Meet you at the pub in about 20 minutes, have a pint and watch this shit blow over lol.

Jaytee left a reply on How To Add Auth In /employer/ And Beyond • 3 weeks ago

Yep, you could put it in your routes/employer.php file too. Just make sure that you don't have two prefixes (based on what you have already, you already have an employer prefix on the routes).

Jaytee left a reply on Undefined Variable: Forum • 3 weeks ago

Fuck me!

You've shown us the ForumController, but we don't need that. What we need is the the contents of the view file (forum/index.blade.php & post-list.blade.php)

Please, 19 replies and still no where near to what everyone has asked for.

Jaytee left a reply on Undefined Variable: Forum • 3 weeks ago

If you aren't including this partial post-list.blade.php in your index view, then of course it won't work.

Jaytee left a reply on How To Add Auth In /employer/ And Beyond • 3 weeks ago

Add a route group and apply a middleware to it so that only employers can access it.

Something like:

Route::prefix('employer')->middleware('employer')->group(function () {
    Route::get('home', '[email protected]'); // yourdomain.com/employer/home
    // define more routes here
});

16th November, 2017

Jaytee left a reply on Laravel 5.5 Doesn't Authenticate Properly Based On Database Columns • 3 weeks ago

  1. Update $fillable property on the User model
  2. Make sure to hash the password in the factory
  3. Update the RegistrationController to update the fields for your table.

Spoke on discord

15th November, 2017

Jaytee left a reply on Laravel Validation Rules: Ignore Unique Doesn't Is Completely Ignored. • 4 weeks ago

Kinda stupid to have name as your primary key. Now you're setting yourself up for a failure when it comes to someone with the same name.

And you can plead and say that won't happen, but chances are, it will sooner or later.

But anyways, you can't use the rule unique then as it expects an ID irregardless of what the primary key is.

You could try using a closure and narrowing it down (see the docs again), but otherwise, search based on the user's id, not name.

14th November, 2017

Jaytee left a reply on Laravel Validation Rules: Ignore Unique Doesn't Is Completely Ignored. • 4 weeks ago

Take a look at the docs here: https://laravel.com/docs/master/validation#rule-unique

You're receiving a non-object error because you're saying that the primary_key for the user model is actually name. So Laravel is looking for a name in the users table that equals the ID (number) of the user, of course, no results are found.

2nd November, 2017

Jaytee left a reply on Post Won't Delete Using Job • 1 month ago

Yeah a job isn't really recommended for this. It's not an expensive task.

Think about it, if its a traditional request (not ajax), then when the page reloads its going to be gone -- giving it the immediate removal.

You can either do that approach, or use an ajax request to delete the post, and then use JS to remove the post from the front end when the button is clicked.

27th October, 2017

Jaytee left a reply on Can I Update User Profile By Username Instead Of User ID • 1 month ago

You guys should take a look at this line:

public function UpdateLoginProfile(Request $request, $username = 'Auth::user()->username')

22nd October, 2017

Jaytee left a reply on Create Doesn’t Work Even With Empty Guarded Array • 1 month ago

Yeah sure us some code. And make sure you've set guarded correctly. protected $guarded = [].

21st October, 2017

Jaytee left a reply on Can I Use Require Js File From Node_modules • 1 month ago

You do: require('jquery');. No need for the full path.

15th October, 2017

Jaytee left a reply on Best Way To Become A 'web Programmer' • 1 month ago

Strangely, I'm at the point where i can help people better than i can code lol.

I've been procrastinating for the past two months, to sit down and have a good coding session to finish up my work. Yet if someone asks for help, i'm there within 1 minute and helping.

Can anyone else relate? Or am i just burnt out?

Jaytee left a reply on Can't Get Thread_is Even Though Followed As Shown In Series 'Lets's Build Forum With Laravel' • 1 month ago

If you're passing the thread in via route model binding, then i believe strict wildcard checking comes in to play.

You'll need to change the wildcard from {id} to {thread}.

12th October, 2017

Jaytee left a reply on Problem With Custom Validation Rule • 2 months ago

Be sure that you have:

  1. Laravel 5.5
  2. Updated the Laravel installer
  3. Imported the rule class

11th October, 2017

Jaytee left a reply on Limit No Longer Works As Intended After Eager Loading? • 2 months ago

Try the take() method instead.

Or try this approach in the controller:

$replies = $thread->replies()->with(['user.forumBadges' => function ($query) {
    $query->orderBy('display_order', 'asc')->take(5);
}]);

And then remove the orderBy and take from the method on the model.

Jaytee left a reply on Instantiating A Class (from A Laravel Package) Inside Of A Controller • 2 months ago

Yep that error is because the package is old and has no namespace. Since Laravel uses namespaces everywhere (apart from helper files), it allows composer to pick up on these and load them in.

There is a laravel package which is just a clone of the one you're trying to use, with an addition. It has namespaces and a service provider.

You can find it here: https://github.com/sonnenglas/amazon-mws-laravel

This one will work for you, just follow the documentation on the github page.

Jaytee left a reply on Instantiating A Class (from A Laravel Package) Inside Of A Controller • 2 months ago

Laravel doesn't assume that it's looking for a controller. It's just looking for a class (the one you have specified).

Instantiating AmazonOrderList should work as you'd expect. Now the package is old, so it's probably failing because it doesn't have a namespace.

What you'll need to do is use include or require at the top of your file and then give the full path to the file.

Alternatively, find an updated package that makes use of namespacing and autoloading.

Jaytee left a reply on Can't Validate Mp3 File When Upload File In Laravel • 2 months ago

Try:

'something' => 'mimes:mp3'

10th October, 2017

Jaytee left a reply on How Can I Solve This Error: Class 'App\Http\Controllers\Auth\Role' Not Found • 2 months ago

You haven't imported the role class correctly. If you haven't changed the directory structure, then it should be one of these:

use App\Role;
use App\Models\Role;

9th October, 2017

Jaytee left a reply on Mysterious String Phenomena • 2 months ago

Your original problem was with this line here: <a href="{{ route('/chickens/{variety}{name}/create', ['variety' => $chicken->variety, 'name' => $chicken->name]) }}">create</a>.

When you use the route() method, you give it a name instead of the URL. You were passing the whole route AND the wildcards which is a no no and a recipe for disaster (which happened).

When you use the as key on the route or when you chain on ->name('some.name'); is when a route becomes a named route.

So for example, to use the route() method:

Route::get('/', '[email protected]')->name('home');
Route::get('/', ['uses' => '[email protected]', 'as' => 'home']); 

// both of them are the same
// Then i'd do something like

<a href="{{ route('home') }}">a link</a>

// if i need to pass one parameter, i would pass it as the second argument
<a href="{{ route('home', $user->username) }}">a link</a>

// if i need to pass more than one parameter, i would pass an array as the second argument

<a href="{{ route('home', [$user->username]) }}">a link</a>

Jaytee left a reply on Homestead - Cannot See Database Tables • 2 months ago

Remember that when using something like Sequel pro and Homestead, you need to use the Homestead IP. 192.168.10.10 and then the credentials which is usually homestead and secret

Jaytee left a reply on Mysterious String Phenomena • 2 months ago

Yeah something is going wrong somewhere.

Can you show me the controller and view please.

Also, if you can show me where you're passing the parameters for the URL (e.g: a form or button).

Alternatively, what you could do is just have a generic /chickens/create route and have a couple of select boxes which a user selects for the variety and name.

Jaytee left a reply on Blade Templating Issue... • 2 months ago

I've noticed in your navbar section, you're using @section(). If you're trying to insert data here, it should be @yield().

Then in the pages where you extend the template, you can use @section.

P.S: You don't need to have the / on html tags that do not have a closing tag. i.e: <meta />, you can just do <meta>.

P.S.S: I also hope you have <!DOCTYPE html>, <html>, <head>, and <body> tags

8th October, 2017

Jaytee left a reply on <style> In View • 2 months ago

@jlrdw I think it's like discord dude, you do three backticks and then the name of the language


test

Jaytee left a reply on Couple Vagrant Questions • 2 months ago

Yep you can, just change it in your homestead.yaml file.

7th October, 2017

Jaytee left a reply on Namespace Declaration Statement Has To Be The Very First Statement • 2 months ago

In settings, change this value and try ANSI:

"default_encoding": "UTF-8",

If that fails, revert back. UTF-8 is my default and I use sublime. P.S: if the namespace declaration error is just happening in the one class, try deleting it and create it again.

Jaytee left a reply on Couple Vagrant Questions • 2 months ago

Jeff doesn't use homestead anymore, he uses Valet (for mac).

Homestead will install all of that stuff for you. But you need to ssh into the vm and then do things like running composer.

Just follow the homestead installation guide, and you'll be on your way. If you need to install / upgrade something, you ssh into the VM first and then do what you need to do.

Jaytee left a reply on Namespace Declaration Statement Has To Be The Very First Statement • 2 months ago

What text editor are you using? Saw some people say change the encoding type from UTF-8 to ANSI

Jaytee left a reply on Disable Eager Load • 2 months ago

It's a great API. If you can guess what you're looking for, you're probably right.

And if you're not sure, you can search the API docs here: https://laravel.com/api/master/

Jaytee left a reply on TypeError: Too Few Arguments In Function • 2 months ago

The show method is for showing one user. IF you want to show multiple, use an index method.

Your show method is only querying one user, so why are you looping over it? Again, thats a job for the index method.

Jaytee left a reply on Disable Eager Load • 2 months ago

Bar::with('reports')->without(['reports.invoice', 'reports.act']);

But remember, the point of setting the with property is so that they are always eager loaded. If in a lot of situations you don't want them loaded, just don't set the with property.

Jaytee left a reply on Why Do I Always Get A 404 In My Test? • 2 months ago

According to the docs, routes go in the boot method, not the register method. If that still doesn't work, use this from the docs in the boot method.

Put them into a routes file and then use $this->loadRoutesFrom(__DIR__ . '/routes.php');

Jaytee left a reply on Trouble Accessing An Array • 2 months ago

Not sure why you need the index, but that's PHP for you lol.

If you don't like that approach, just turn it into a collection.

$visits = collect($visits->getPageUrls(['period' => 'week', 'expanded' => '1', 'segment' => 'pageUrl%3D%5Ehttp%253A%252F%252Ftesting.dev%252Fblog%252F']););

Jaytee left a reply on DRY Related • 2 months ago

You're best to use middleware. That way, you can either put it on the constructor or on the routes itself.

Middleware is the intended use for this, trying something new is great and all, but in situations like this, it isn't necessary.

Jaytee left a reply on Pass Variable From Request Into Config::set • 2 months ago

Don't use quotes for the variable here, otherwise it's always going to search for the string literal $iid

if (!Storage::disk('doc')->exists('$iid'))

6th October, 2017

Jaytee left a reply on Migration Quick Question • 2 months ago

Name the migration something else.

As a convention, when creating tables:

php artisan make:migration create_{table}_table

And when adding to an already existing table:

php artisan make:migration add_{field}_to_{table}_table // or something else that describes what you are doing, for example:

php artisan make:migration update_{table}_table

If you're doing this in development, you might aswell just drop all tables and change it within the main migration file, since usually you use dummy data in development.

IF in production, it's important to create a new migration to modify an already existing table, otherwise you will lose real data.

5th October, 2017

Jaytee left a reply on Preventing Two Users To Update A Model At The Same Time • 2 months ago

Couple ways you could do it

  1. Like the way you've done it.
  2. Add a locked field that expires after X minutes
  3. Use Javascript (and optionally use websockets) when a user clicks on it, it locks it using an AJAX request. If you use websocket, you can display a live message instantly to say "so and so has already accessed this ticket".

Jaytee left a reply on Route Group Name In Laravel 5.5 • 2 months ago

There's nothing wrong with grouping routes under a name, the docs will have it like the user above has posted.

I personally, don't use groups with/without names anymore, only because of two reasons:

  1. My routes file doesn't look as aesthetic (personal thing, don't ask lol)
  2. Explicitly defining routes seems to read better for me.

Jaytee left a reply on Why Does Laravel Use Snake Case For Helper Functions? • 2 months ago

  • i don't know about you but:

arrayAdd looks like shit lol

Jaytee left a reply on PHP Array Output • 2 months ago

In the future, make sure your question is understandable.

Fortunately, I was able to know what you need. You want the results to be the values and not the keys/indexes.

You need to use array_values

without array_values

array:2 [
  0 => array:5 [
    0 => "a"
    1 => "b"
    2 => "c"
    3 => "d"
    4 => "e"
  ]
  1 => array:5 [
    0 => 1
    1 => 2
    2 => 3
    3 => 4
    4 => 5
  ]
]

** with array_values **

array_values($arr);
[
     [
       "a",
       "b",
       "c",
       "d",
       "e",
     ],
     [
       1,
       2,
       3,
       4,
       5,
     ],
]
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.