Jaytee

Experience

103,905

103 Best Reply Awards

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

21st April, 2018

Jaytee left a reply on No Default Value • 2 months ago

You should of known about mass assignment within one month, never mind one year. 99% of the shit you post is basic stuff.

The username is required to be in the fillable array, otherwise it won't be inserted.

4th March, 2018

Jaytee left a reply on About Me • 3 months ago

The likelihood of you becoming a great developer in one year, is slim.

I've been at it for about 4 years, i'm still not a "great" developer. I'm constantly learning. It took me about a year to actually piece together a basic website without researching.

This stuff takes time. One year is a high target for a milestone.

17th February, 2018

Jaytee left a reply on Odd Behaviour With Collections.reverseOrder? • 4 months ago

This is a PHP forum not a Java forum

6th February, 2018

Jaytee left a reply on Pusher Not Working, No Push Notifications, Is Echo Working At All? • 4 months ago

  1. php artisan queue:work or php artisan queue:listen (run this before anything)

  2. Double check

  3. Yep

  4. No the broadcasting routes in routes/channels.php. You need to have a route for the channel you're trying to push data to. The route needs to either return true or false (true meaning the user is authenticated, false meaning no). Consult the Laravel docs.

Jaytee left a reply on Pusher Not Working, No Push Notifications, Is Echo Working At All? • 4 months ago

  1. Make sure the queue is running
  2. Make sure Pusher config is correct
  3. Make sure the broadcast service provider is uncommented
  4. Make sure the broadcast route is setup.

22nd January, 2018

Jaytee left a reply on Change Version Of Bootstrap Installed • 5 months ago

@tisuchi The official version of Bootstrap is out now, so it's as simple as one of these:

  1. npm install bootstrap

  2. Modify package.json "bootstrap": "4.0.0"

21st January, 2018

Jaytee left a reply on Filling The <title>... Controller? Routes? • 5 months ago

Some are explicit and yield the title @yield('title') and then fill it for each page, some pass it from the controller, some use the current route for it.

Some pull in a package like this and do it in the controller: https://github.com/artesaos/seotools

All depends on what you want really

Jaytee left a reply on Set Default Value For User • 5 months ago

Go with option one to what @Cinek said. I presume you're still in development so rolling back migrations isn't an issue since you should just be working with test/dummy data.

20th January, 2018

Jaytee left a reply on How Can I Uninstall Laravel-mix Completely From 5.5 ? • 5 months ago

Just delete the node_modules folder, then remove laravel mix from package.json then run npm install to install the dependencies again.

Jaytee left a reply on Entrust • 5 months ago

Don't comment on stuff that's old @Bhargav960143 .

But to close this topic with a solution: There are better solutions out there now, Bouncer, Spatie's Permissions, A maintained version of Entrust called Laratrust etc.

19th January, 2018

Jaytee left a reply on Bootstrap Select Into Laravel Collective • 5 months ago

Collective is old, and no longer a benefit. Switch to writing regular forms.

18th January, 2018

Jaytee left a reply on Authorize Null Field On Create But Make It Required On Update • 5 months ago

So as per your title, you're just wanting to make the fields nullable on create, and required on update?

Well you should already have two different methods, one for creating and one for updating, so just update the validation rules accordingly.


public function store()
{
    $data = request()->validate([
        'field_one' => 'nullable'
    ]);
}

public function update($theResourceOrID)
{
    $data = request()->validate([
        'field_one' => 'required'
    ]);
}

Jaytee left a reply on Upgrade Laravel Version • 5 months ago

Follow the upgrade guide. 5.2 had a different built in auth. Go to Laravel docs and click on the upgrade guide.

Jaytee left a reply on Bootstrap 4 - Fixed Navbar Full Width Collumn • 5 months ago

A fixed position is positioned based on the viewport so naturally it won't work.

What you can do, is specify a width for the navbar and then use the left: amount property in CSS to position it with the column.

But with that, you do also need to determine the width of the column on the left so that you know how much to move the navbar left, and of course with different resolutions, it will change.

I would say to use the position: sticky but it's not very well supported.

If you want to take an easier approach, i'd suggest either making the navbar fixed at full width or making the sidebar relative (so when you scroll, it'll disappear).

Jaytee left a reply on NodeJs • 5 months ago

Master PHP first, that's something you definitely haven't done yet.

Essentially you use Javascript for the server-side and the client-side. No need to mix with other languages (e.g: PHP for server, JS for client).

1st January, 2018

Jaytee left a reply on PHPUnit Won't Run One Test In A File But The Rest Are Fine • 5 months ago

Make sure you're telling PHPUnit about the test. Either with a doc block or prefixing the function with test_

Doc Block:

/* @test */

26th December, 2017

Jaytee left a reply on Artisan - Intelligence • 5 months ago

Basically, there's two classes in the framework. One named Pluralizer and the other called Inflector.

The inflector houses a log of Regular Expressions to match for the word and then replaces it with the pluralized/singular version of the word.

From what i've tested, and copied from the Inflector class, this is the Regular Expression responsible for the word company

'/([^aeiouy]|qu)y$/i' => 'ies',

And in fact, if you go to regexr.com and paste this in ([^aeiouy]|qu)y It will return a match on the word company.

22nd December, 2017

Jaytee left a reply on Changing Default Tinker Namespace? • 6 months ago

Sweet, done and dusted!

Jaytee left a reply on SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'article_id' Cannot Be Null (SQL: Insert Into `comments` (`body`, `article_id`, `updated_at`, `created_at`) Values (adding New Comment, , 2017-12-22 03:21:15, 2017-12-22 03:21:15)) • 6 months ago

When using Route Model Binding, Laravel expects the wildcard in the route to match the same as the method parameters.

Your method parameter is accepting an instance of Article Article $article, but your route is defined as accepting a {post}. Change {post} to {article}

Jaytee left a reply on Changing Default Tinker Namespace? • 6 months ago

Haven't used Spark, but I can't imagine anything will be different unless it's using a different version of Tinker.

Did you quit and go back into Tinker when you made the change? And I'm not sure what the Spark structure is like, but i'm guessing the User model and Team model is within the app directory, where as all your other models are within a models directory?

Just doing something like User::create() in Tinker, should alias it to YourNamespace\Path\To\User.php

Jaytee left a reply on Any One Knows,where Dd() Is Defined In Laravel? • 6 months ago

Could just be a syntax error from yourself, can you post the code where you're using dd().

The helpers file goes untouched unless you personally have touched it, so that shouldn't be the issue.

Jaytee left a reply on Changing Default Tinker Namespace? • 6 months ago

Tinker should pick up on the namespace. The version included with 5.5 also allows you to just call the model without including the namespace and it will alias it to the namespace.

14th December, 2017

Jaytee left a reply on Remember Me Not Working • 6 months ago

Remember me only lasts for 2 hours by default.

You can update this value in your env file for the SESSION_LIFETIME. Or if you're using a slightly older version of laravel, you can update the config/session.php file.

The value is in minutes, so for 24 hours, the value should be: 1440

Jaytee left a reply on How To Deal Large Dataset Using Eloquent? • 6 months ago

If you have that many records, then it's pointless paginating them all. Just get the most recent ones, perhaps 500 of them and then paginate.

Unless you have absolutely no time on your hands, no one is gonna sit through and paginate through all those records.

13th December, 2017

Jaytee left a reply on 404 Response For "webhook/stripe" Url For Test Domain? • 6 months 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? • 6 months 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 • 6 months 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? • 6 months 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 • 6 months 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> • 6 months 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 • 6 months 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 • 7 months 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 • 7 months 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 • 7 months 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 • 7 months 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 • 7 months 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 • 7 months 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 • 7 months 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 • 7 months 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. • 7 months 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. • 7 months 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 • 7 months 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 • 7 months 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 • 8 months 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 • 8 months 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' • 8 months 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' • 8 months 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 • 8 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? • 8 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 • 8 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.

Edit Your Profile
Update

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