Cronix

Experience

336,110

421 Best Reply Awards

  • Member Since 4 Years Ago
  • 615 Lessons Completed
  • 3 Favorites

25th April, 2018

Cronix left a reply on My Model Is Pulling The Same Data Three Times Instead Of Looping Properly. • 5 hours ago

Are you sure the 3 logins have the exact same permissions on the rets side?

Cronix left a reply on My Model Is Pulling The Same Data Three Times Instead Of Looping Properly. • 5 hours ago

Aren't they all technically the same server? You're just querying different cities? The connections you showed all use http://matrix.swflamls.com/rets/login.ashx

Cronix left a reply on My Model Is Pulling The Same Data Three Times Instead Of Looping Properly. • 6 hours ago

Also, it's quite helpful to join the phrets slack channel. It's not super active, but there are usually very knowledgeable people there, including Troy himself (author of phrets).

http://phrets.troda.com/

Cronix left a reply on My Model Is Pulling The Same Data Three Times Instead Of Looping Properly. • 6 hours ago

One thing to note with rets feeds. All dates on the RETS server are stored as UTC. So when you run queries using dates, you need to convert your local date to UTC for the query to work correctly, or you could get duplicate results when retrieving the newest. This gets more complex though, because when the rets server returns timestamps, they are in the servers local timezone (not UTC). I don't know if you're running into this or not, but thought I'd throw it out there. It took awhile to figure it out.

So when querying, use UTC time. When retrieving the results, they are in the servers local timezone. Also, the rets server might not be physically located where you are. It might actually be in a different timezone than where the physical MLS is located.

And depending on what version of RETS the rets server is using (1.5/1.7.2/1.8 etc) this changes too. Rets 1.7 servers should report their timezone, but not all do, and not all advertise the correct timezone. 1.5 servers don't report the timezone they are in at all, so you have to figure it out by some tricky queries.

Here's a good read: https://github.com/troydavisson/PHRETS/wiki/Timezone-Handling

Cronix left a reply on Laravel Register Form Isnt Working • 11 hours ago

You're welcome! I'm glad you got it resolved.

Cronix left a reply on Laravel Register Form Isnt Working • 11 hours ago

What was the fix?

Cronix left a reply on Laravel Register Form Isnt Working • 11 hours ago

Couldn't say. Doesn't sound like it, but who knows. I'd use your IDE's search feature and look for all dd and dump commands and remove them/comment them out.

Cronix left a reply on What Things Can Cause A Memory Leak In A Laravel Project? • 11 hours ago

Yes, but the end result is the same lol.

Cronix left a reply on Laravel Register Form Isnt Working • 11 hours ago

If your project isn't too far along, I'd delete it and reinstall following the guide, and NOT run php artisan make:auth. Or maybe just create a new fresh project instead of deleting, and copying your custom code over.

As I mentioned, it has it's own auth built in and it's not 100% identical to the one with a stock laravel running make:auth.

Cronix left a reply on Videos Not Playing • 11 hours ago

I could see some js errors in the console when it wasn't working.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

Ok, I don't have any other ideas then. I just know that the code you showed is coming from a dd() or dump() command somewhere. That's the only time it would ever create that js and laravel provides those helper functions for developers, but doesn't use them anywhere on its own.

You can make your own regular controller method, retrieve a user and dd($user) and check the source of the generated html. It will look almost identical to what you showed, except contain different data.

Cronix left a reply on What Things Can Cause A Memory Leak In A Laravel Project? • 12 hours ago

@avaneeshsingh Interestingly enough, it's mentioned in older docs, but not for more recent versions: https://laravel.com/docs/4.2/database#query-logging

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

This wouldn't have anything to do with app.js. Laravel also doesn't have any dd() or dump() in their code, so it had to come from something you put somewhere. Check the controllers, views, etc.

Also try running php artisan view:clear to clear the view cache.

Cronix left a reply on B"string" Error • 12 hours ago

You might try searching and raising an issue in the laravel repo: https://github.com/laravel/framework/issues

Cronix left a reply on What Things Can Cause A Memory Leak In A Laravel Project? • 12 hours ago

This was actually on a 5.4 project, and it was enabled by default. Not sure if it has something to do with the environment (local/production/etc), but I was using local at the time.

Cronix left a reply on Videos Not Playing • 12 hours ago

Try again. I tried it when I read your post and checked and they weren't playing for me either. After a minute or two they started working so could have been a temp issue with vimeo.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

Check your code. It really looks like you have a dd(something) or a dump(something) in your code somewhere, since that's the javascript that those commands produce.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

Also, you should not have run make:auth. You might have messed something up despite being able to register a single user. Spark already has the auth system in place.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

@abudo keep looking in the network tab. There should be tabs showing the headers, cookies, parameters sent, the response received and a few other things. Click on the one that has the error and look at the right side of the panel. It's different for different browsers, but they should show more info than you posted.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

@avaneeshsingh actually it might contain a response, with the response being a whoops page.

Cronix left a reply on What Things Can Cause A Memory Leak In A Laravel Project? • 12 hours ago

One thing laravel does is track all queries that are run in memory for each request cycle. For regular pages, this isn't a big deal, but if you are running a long process that is making thousands of queries, it could overrun the memory. Like I have a process that takes several hours pulling down real estate listings from various api's, and parsing the results and inserting the records into the db, which results in hundreds of thousands of queries. It would run fine for about 30 minutes or so until it overran the memory (512M). The only fix I've found for it is:

\DB::disableQueryLog();

and then it would run for hours and the entire process consumed no more than 6M, and it was a lot faster as well. So, I just put that before any long running process and it's been fine.

Cronix left a reply on Laravel Register Form Isnt Working • 12 hours ago

did you run php artisan make:auth on top of the spark install (which already has the auth built in)? Does your error log provide any clues on the 500 error?

Cronix left a reply on Detect When A User Leaves A Specific URL • 14 hours ago

When the user enters page to edit a post, set the flag in the db for that post. When they save the changes, remove the flag and redirect them somewhere other than the edit page for that post.

Cronix left a reply on Ajax Request And Foreach Loop • 15 hours ago

He'd also have to change this

jQuery('#ajaxVote').click(function(e){

to

jQuery('.ajaxVote').click(function(e){

since the buttons would be using a classname instead of an id

Cronix left a reply on Make A Foreach With A JSON Array • 15 hours ago

Did you look at the examples in the php manual I linked to. It converts a json object to a php array, which then php can iterate over. You can't directly iterate over a json object in php. It needs to be something php understands, like an array. PHP doesn't speak json.

Cronix left a reply on Make A Foreach With A JSON Array • 16 hours ago

Convert it to a php array, and iterate over that. http://php.net/manual/en/function.json-decode.php

Cronix left a reply on How To Redirect The User To A Specific Page If He Click In The Browser Back Button? • 16 hours ago

There's not a good solution for this. You can't change the actual back buttons behavior, but you can manipulate the browsers history ( https://developer.mozilla.org/en-US/docs/Web/API/History_API ). The back button isn't part of the dom or html, it's in the browser so you can't get access to it.

One way around this it to use modals and ajax for your forms, so the user doesn't actually leave the page. All steps could be performed in a single modal. You could add your own back button (back to step 1) to the modal that just hides Step 2 and shows Step 1. It would be more coding, but would be faster (no full page reloads for each step) and a better user experience and solve your dilemma.

24th April, 2018

Cronix left a reply on Can't Turn An Object Into An Array. • 1 day ago

->toArray() only works on certain laravel objects, like models, not php objects in general.

You could try just typecasting it to an array, but you'd only get visible (public) properties.

$results = (array) $results;

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Did you try doing what I last suggested? It won't mess with laravels default password reset.

Cronix left a reply on Delete Function Not Working • 1 day ago

try running php artisan view:clear.

<form method="POST" action="{{ route('thread.delete', $thread) }}" id="deleteForm">
    @csrf
    @method('DELETE')
    <button type="submit">Submit</button>
</form>

this should work with Laravel 5.6.x and actually submit. You say nothing happens when you click submit. I don't know what else could be going on unless you have some other javascript going on that we don't know about.

Cronix left a reply on $schedule->job(new QueryJob()) Can't Find The Model's Database Connection Driver • 1 day ago

I'd try restarting the queue workers anyway. The queue worker typically runs in memory and doesn't terminate, unlike a web request that terminates right after the request is completed. It only knows about the code that's present when you first start the queue worker(s). Artisan tinker does the same thing. If you have tinker running and make some code changes, tinker doesn't know about it unless you exit/restart tinker.

Cronix left a reply on Delete Function Not Working • 1 day ago

And is it actually deleting the things you are telling it to, but just causing an error on top of it?

Cronix left a reply on Delete Function Not Working • 1 day ago

@hjortur17 what version of laravel are you using?

Cronix left a reply on $schedule->job(new QueryJob()) Can't Find The Model's Database Connection Driver • 1 day ago

Did you recently add this connection? Were the queue workers already running when you did (if you did)? If so, you need to restart the queue workers for them to pick up on your changed code.

Cronix left a reply on Delete Function Not Working • 1 day ago

@rin4ik return back(); will probably cause an error since you just deleted the item you're returning to.

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Ok, then change the name on the route

Route::get('/password/reset/{token}', '[email protected]')->name('custom.password.reset');

and in the email view, change it to the same thing

<a href="{{ route('custom.password.reset', $token, false) }}">Click here</a> to set your password!

You can call it whatever you want as long as it matches in both places. I just used "custom.password.reset"

Using route('password.reset') sends it to laravels default password reset method. You need a different name so it will use yours in your special case here.

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Ah, I had it backwards, which seems strange that it works this way. Try switching the order

Auth::routes();

Route::get('/password/reset/{token}', '[email protected]')->name('password.reset');

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

sorry, it should be [email protected], but I don't think that will work anyway as it doesn't seem to register the route like I was thinking. I was pretty sure you could override the default route.

Is this in addition to, or replacing Laravels default password functionality?

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Try just adding this route before Auth::routes(); so it will use your route instead of the default.

Route::get('/password/reset/{token}', '[email protected]')->name('password.reset');

Auth::routes();

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Not to do with your question, but I just noticed a typo in "account" for your email subject.

->subject('Bchain Shares accout details')

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

OK, the default for that goes to App\Http\Controllers\Auth\[email protected]

Don't you want it to go to [email protected]?

Cronix left a reply on Issue With Password Reset Tokens • 1 day ago

Do you mind posting your relevant routes, particularly the one named password.reset?

Cronix left a reply on Reset Password Manually Without Email • 1 day ago

The token field name should be _token, not token. You can also just use

{{ csrf_field() }}

or in more recent versions of laravel

@csrf

Cronix left a reply on Cannot Update My Data From My Edit From • 1 day ago

Oh, respectful like this?

@Vilfago you are wrong

Cronix left a reply on Cannot Update My Data From My Edit From • 1 day ago

Or just do it like I showed on the previous page many posts ago lol

<form class="col-md-6" method="post" action="/posts/{{ $post->id }}">

Cronix left a reply on How To Add $request Values To My Validation Request In Controller? • 1 day ago

The other option is to pass $request to the closure. The closure knows nothing about outside variables as they're not in the scope of the closure. Yes you can use the request() helper, but that will only work for that circumstance. What if you had a different variable that wasn't coming through via the $request object?

public function storeReceiver(Request $request) {

    request()->validate([
        'phone_number' => Rule::unique('users')->where(function ($query) use ($request) {
            dd($request); //$request should be found now
            $user_id= auth()->user()->id;
            $org_id = OrgUser::where('user_id', '=', $user_id)->where('cat_id', 1)->first()->org_id;
            return $query->where('org_id', '=', $org_id);
        }),
    ]);
}

notice the use ($request) here:

Rule::unique('users')->where(function ($query) use ($request) {

Cronix left a reply on Cannot Update My Data From My Edit From • 1 day ago

Also, you need to add the id of the post you're editing in the form action.

<form class="col-md-6" method="post" action="/posts/{{ $post->id }}">

which is why it's going to the wrong endpoint. You probably don't need that route I suggested since it should be covered by the Route::resource() route.

Cronix left a reply on Cannot Update My Data From My Edit From • 1 day ago

@jlrdw that does not apply here, especially due to the way he's saving.

@towhid the Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException is always due to sending the wrong type of request to an endpoint (route). Like you are sending a PUT request to a Route::get(), or something.

Since you're using PUT, you need a

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

Cronix left a reply on Redirect On Firefox Send To Https Instead Of Http • 1 day ago

Cool, that's what I thought. Please mark the issue as solved.

Cronix left a reply on How To Validate This Context? (The Custom Question Can Be Required Or Not Depending On Wether Is "1" Or "0" In The Column "required" Of The Ticket_type_questions Table) • 1 day ago

The validator takes a 3rd argument where you can customize the messages. I'm not sure how you'd use the "question name", or where that actually would come from.

Try something like

$messages = [
    'participant_question.*.required' => 'The participant question is required'
];
$validator = Validator::make($request->all(), $rules, $messages);

See the "custom error messages" section: https://laravel.com/docs/5.6/validation#working-with-error-messages

Edit Your Profile
Update

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