temwa

temwa

Member Since 1 Year Ago

Experience Points
470
Total
Experience

4,530 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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.

Level 1
470 XP
Aug
20
1 month ago
Activity icon

Replied to Email Error In Logs When Not Sending Mail

@cronix , sorry about the confusion. When I wrote the post I didn't take into account that the app is now in a live environment and mail could be sent even though I didn't initiate it. It was your suggestion to search for "Mail::" in my code that made me realise mail was being sent from 3 places in my app.

Activity icon

Replied to Email Error In Logs When Not Sending Mail

I have found a mistake when calling mailer in 1 of the 3 places where the app sends mail. I had Mail::to(Auth::user()) instead of Mail::to(Auth::user()->email).

This is an order form and I suspect there is a bot hitting the site although correcting this mistake has not resolved the issue. It is possible that its because some of the mail with the mistake are still in the queue. I'll give it some time and check again.

Thanks

Activity icon

Replied to Email Error In Logs When Not Sending Mail

@cronix , I have already set up the email settings in .env. Is there any way to find out what packages could possibly be sending out mail especially because it is happening constantly?

Activity icon

Started a new conversation Email Error In Logs When Not Sending Mail

Hi,

I am getting the following error in my Laravel logs on Forge and it happens even though I am not sending any mail;

[2019-08-20 20:03:58] production.ERROR: Address in mailbox given [] does not comply with RFC 2822, 3.6.2. {"exception":"[object] (Swift_RfcComplianceException(code: 0): Address in mailbox given [] does not comply with RFC 2822, 3.6.2. at /home/forge/sales-press.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355) [stacktrace] ...

This error is being reproduced every second in the logs and making my logs swell up very quickly.

Can someone please help?

Activity icon

Replied to Adding A Bash Script In Laravel Forge Scheduler

There was no need to prefix the path with "php". Just including the path to the script works.

Aug
19
1 month ago
Activity icon

Replied to Adding A Bash Script In Laravel Forge Scheduler

Hi @nash . Yes, I have checked and Logrotate is installed but I do not understand its setup. However, after reading the documentation, I feel it is just a different approach to using the Forge scheduler to achieve the same thing. I just need to know how to call a php script using the $schedule->exec() command.

Activity icon

Replied to Adding A Bash Script In Laravel Forge Scheduler

Thanks @cronix .

I just need one clarification. In the Laravel documentation a node script is called as below;

$schedule->exec('node /home/forge/script.js')->daily();

Do I also need to prefix the path to the script with php like below;

$schedule->exec('php /home/forge/script.sh')->daily();

or just use the path without the php prefix like below;

$schedule->exec('/home/forge/script.sh')->daily();

Aug
18
2 months ago
Activity icon

Started a new conversation Adding A Bash Script In Laravel Forge Scheduler

I would like to add a bash script that periodically deletes logs on Laravel Forge. I have placed the script in /home/forge/mysite.com/scripts/delete_logs.sh. How do I reference this file in the Forge Sheduler. The default command in the sheduler is as below;

php /home/forge/default/artisan schedule:run

How do I modify this command so that the sheduler may reference my Bash script?

Thanks.

Feb
21
7 months ago
Activity icon

Replied to SSH Login Not Working

@mushood , Thank you. I have contacted them and got several responses. Thanks for your help.

Activity icon

Replied to SSH Login Not Working

I have the public key enabled in Laravel Forge. I don't know where or if I am also suppoed to enable the private key.

I think bash access is enabled on the server because I was able to connect before.

The problem started when there was a process on the server that just spiked all of a sudden to 100% or near 100%.

Activity icon

Replied to SSH Login Not Working

Hi @mushood

Thanks. Yes, I have the private key. I have tried it but the connection is just timing out.

Activity icon

Started a new conversation SSH Login Not Working

When I try to ssh into my server as below

ssh [email protected] -i ~/.ssh/id_rsa.pub (Not the atual IP address)

I get the error below

ssh_exchange_identification: Connection closed by remote host

I contacted support on Laravel Forge and have been advised to use the private key. How do I do that? I am only familiar with using the public key.

Oct
04
1 year ago
Activity icon

Replied to Updating Value

dio7. What was the solution

Jun
20
1 year ago
Activity icon

Replied to Forge Password For SFTP Not Working

It turns out Forge has disabled password logins and my FTP client is in such a way that I cannot login without a password even tough I have provided SSH credentials. I have therefore switched to Filezilla from FireFTP. Filezilla allows me to provide file authentication with just a username, "forge".

Problem solved

Activity icon

Started a new conversation Forge Password For SFTP Not Working

I am trying to set up an SFTP connection to my Forge provisioned server hosted with Linode. I have added the SSH key and I am able to connect with my FTP Client in SFTP mode. When I try to connect, my FTP client shows that I am connected but failing to authenticate and prompts me for the username and password.

I am using "forge" as the username and the Sudo Password I was issued when provisioning the server as the password.

Dec
15
1 year ago
Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

I found the problem. Silly mistake really. I moved the assignment of data to the JavaScript object used in the array to the global scope and that seems to work.

// Moved this to global scope in the Javascript
var chatUserProfileIds = {"key-60":60,"key-52":52,"key-2":2,"key-3":3}
Dec
12
1 year ago
Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@Dhaval_patel . The values are there in the array and as you saw with the echo statement you asked me to do, it does go through with the echo statement but not the database query.

Besides, it gets stuck on the first pass which is id- 60 and I have checked that id is there in the ajax array, the manual array and in the database except it doesn't work for the AJAX array unless an echo or print_r is called first.

There is surely a problem with the AJAX array and it's not that a value is missing. Its got to be something else with that value that's causing the query to fail. I just don't know what.

Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@Dhaval_patel , I dont think the problem is with the isOnline() method. If I place an echo statement or a print_r() statement before the call to find(), it executes without an error. If I remove that statement to echo or print_r() statement just before calling find() it flags the error;

No query results for model [App\UserProfile] 0

Here is the method, however;

// App\UserProfile

    /* User Online Status */
    public function isOnline()
    {
        return Cache::has('user-is-online-' . $this->id);
    }
Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

Okay @Dhaval_patel . That is working for 60;

// Result
{id: 60, user_id: 133, email: "[email protected]", name: "Barnett Msiska", city: null,…}
bio
:
null
city
:
null
country
:
null
cover_image
:
"../../../no-image/cover-noimage.png"
created_at
:
"2017-12-02 11:52:32"
email
:
"[email protected]"
id
:
60
name
:
"Barnett Msiska"
updated_at
:
"2017-12-02 11:52:32"
user_id
:
133
user_image
:
"../../../no-image/user-noimage.png"
Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@Dhaval_patel . Very weird indeed. When I try with Query Builder, I get the error bellow but the method isOnline() is in the model "UserProfile" that is included with a use statement at the beginning of the controller.

Call to undefined method Illuminate\Database\Query\Builder::isOnline()

Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@kishoresai438 , the record is there in the database. the same code works if I use a manual array and not one passed from the AJAX request.

So, if I say ;

$chatUserProfileIds = array('key-60' => 60, 'key-2' => 2, 'key-3' => 3, 'key-52' => 52);

It finds the record just fine, but will not find it if I say

$chatUserProfileIds = isset($_POST['chatUserProfileIds']) ? json_decode($_POST['chatUserProfileIds'], true):
Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@kishoresai438 , with that I get

Call to a member function isOnline() on null in CheckRunningParametersController.php (line 31)

Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@kishoresai438 , I have changest method to POST, converted JSON to PHP array;

$chatUserProfileIds = isset($_POST['chatUserProfileIds']) ? json_decode($_POST['chatUserProfileIds'], true) ;

I can't do dd() for an AJAX request but print_r() gives;

print_r($chatUserProfileIds);

//Result

array(4) {
  ["key-60"]=>
  int(60)
  ["key-52"]=>
  int(52)
  ["key-2"]=>
  int(2)
  ["key-3"]=>
  int(3)
}

Still doesnt work.

Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@Goldoni , how do I format the URL in the Javascript to pass the array through the route parameters?

Activity icon

Replied to Laravel - No Query Results For Model When Using An Array Passed Via Ajax

@Dhaval_patel , The above PHP Code is the entire controller (CheckRunningParametersController)

Dec
11
1 year ago
Activity icon

Started a new conversation Laravel - No Query Results For Model When Using An Array Passed Via Ajax

I am getting the error;

No query results for model [App\UserProfile] 0

When I use findOrFail using an array passed with AJAX in a foreach loop. If I manually create the array in PHP, the entity is found using the array values. When I do a print_r() on the array in PHP, the array is present in both the AJAX array and the manually created array.

AJAX Code

function checkChatOnlineStatus()
{
    var chatUserProfileIds = {"key-60":60,"key-52":52,"key-2":2,"key-3":3}

    $.ajax({
        url: '/check-chat-online-status',
        method: 'get',
        data: {chatUserProfileIds: chatUserProfileIds},
        dataType: 'json',
        success: function(response) {

        }
    });
}

PHP Code

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\UserProfile;

class CheckRunningParametersController extends Controller
{
    public function checkChatOnlineStatus()
    {
        $chatUserProfileIds = $_GET['chatUserProfileIds'] ? $_GET['chatUserProfileIds'] : NULL;
        //$chatUserProfileIds = array('key-60' => 60, 'key-52' => 52, 'key-2' => 2, 'key-3' => 3);

        /* Check Status For Chat Contacts */
        if ($chatUserProfileIds != NULL)
        {
            foreach ($chatUserProfileIds as $key => $value)
            {


                $userProfile = UserProfile::findOrFail((int)$value);

                $chatOnlineStatus['contacts'][$key] = $userProfile->isOnline();

            }
        }

        return $chatOnlineStatus;
    }
}