gouseferoz

gouseferoz

Member Since 6 Months Ago

Experience Points 1,870
Experience Level 1

3,130 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 2
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.

11 Jul
4 days ago

gouseferoz left a reply on Get Data Without Column Names In Eloquent.

The data doesn't correlate here, I need to get data without the updated_at and total column names. The above thing is just an example.

10 Jul
5 days ago

gouseferoz started a new conversation Get Data Without Column Names In Eloquent.

I was trying to get data from db without column names so that i can pass them to the highcharts stocks like here: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/stock/demo/basic-line/

When i am trying to get data, it is returning something in this format:

[
{
"updated_at": "2019-06-24 17:03:24",
"total": 0
},
{
"updated_at": "2019-06-24 17:39:12",
"total": 2
},
{
"updated_at": "2019-06-24 19:23:50",
"total": 2
},
{
"updated_at": "2019-06-24 19:25:30",
"total": 1
},

How can i get data into this format:

[
[
1499779800000,
145.53
],
[
1499866200000,
145.74
],
[
1499952600000,
147.77
],
[
1500039000000,
149.04
],

Regards, Feroz.

02 Jul
1 week ago

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

@SIANGBOON - The username does have email address.

How can i do the telnet to check the smtp protocol?

01 Jul
2 weeks ago

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

i will hard code the credentials into the mail.php file and see if that works.

gouseferoz left a reply on User Is Not Able To Login When Created Data From Excel Upload

@SNAPEY - Looks like I need my coffee. I was trying with different password that what i provided in the file.

Thanks for pointing it out.

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

@SNAPEY - i did config('mail') and it matches what I intend to. And also checked the quotes around password.

The issue here is, when i trigger a mail, it is sending to mailtrap which i used for testing purpose but now i have replaced it with elastic mail credentials, but the mail is being received in mailtrap.

gouseferoz left a reply on User Is Not Able To Login When Created Data From Excel Upload

@SNAPEY - I followed https://docs.laravel-excel.com/3.1/imports/basics.html this tutorial while working with excel imports.

Yes, I am giving everyone a password in the above case its 123456.

User Model si based off laravel user model and it extends Authenticable

Email and passwords are getting filled in the database.

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

Looks like my .env is caching. The changes i am making to this file is not reflecting.

I tried to clear the cache using

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan config:cache
php artisan route:cache
php artisan optimize

then i am getting this error

   LogicException  : Unable to prepare route [api/user] for serialization. Uses Closure.

  at /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:917
    913|      */
    914|     public function prepareForSerialization()
    915|     {
    916|         if ($this->action['uses'] instanceof Closure) {
  > 917|             throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
    918|         }
    919|
    920|         $this->compileRoute();
    921|

  Exception trace:

  1   Illuminate\Routing\Route::prepareForSerialization()
      /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php:62

  2   Illuminate\Foundation\Console\RouteCacheCommand::handle()
      /var/www/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29

  Please use the argument -v to see more details.

How to solve this issue?

gouseferoz started a new conversation User Is Not Able To Login When Created Data From Excel Upload

I am creating users using by uploading user details using maatwebsite class. I can see the data being saved in database but when tried to login, I am unable to login.

User Import Class

public function model(array $row)
    {

        return new User([
           'name'     => ucwords($row['name']),
           'email'    => $row['email'],
           'password' => Hash::make('password'),
           'user_role' => 'student',
           'type' => 'indirect',
           'admin_id' => auth()->id(),
           'class_id' => $this->classid,
           'regd' => strtoupper($row['regd']),
           'email_verified' => true,
           'mobile' => $row['mobile']
        ]);
    }

When i register using the register page, I am able to login with that record.

Can anyone help me whats going wrong here?

Regards, Feroz.

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

@BOBBYBOUWMANN - Sure, how can I get the logs

30 Jun
2 weeks ago

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

i tried using some elastic mail wrappers too, but they are working in local but not in production. Can someone please help me here?

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

I used the same credentials in local environment and it was working fine without any issue.

The problem is with the production environment

gouseferoz left a reply on Elastic Email Is Not Working In Laravel

@BOBBYBOUWMANN - i tried the above method but it didnt work, the API key and the password are the same in the elasticemail settings.

28 Jun
2 weeks ago

gouseferoz started a new conversation Elastic Email Is Not Working In Laravel

Hi,

I am using elastic email to send my emails. In local, i used mailtrap and it worked fine. I updated the .env file to use elastic mail credentials

MAIL_DRIVER=smtp
MAIL_HOST=smtp.elasticemail.com
MAIL_PORT=2525
MAIL_USERNAME=elasticmail_username
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME=Laravel

Can anyone help me on this?

Regards, Feroz.

26 Jun
2 weeks ago

gouseferoz left a reply on How To Fix Call To Undefined Method Illuminate\Session\Store::first() Error?

So, i found the issue why i am getting the above issue.

I used

@if(Session::has('error')
//Some Code here
@endif

If i remove this block, i dont see the issue. Why is that?
21 Jun
3 weeks ago

gouseferoz left a reply on Is It Good To Use Queue In Laravel For Mails?

@DEANSATCH - sorry, i forgot to reread the file and start the supervisor again, i did it now and its working.

Thanks for the help.

gouseferoz left a reply on Is It Good To Use Queue In Laravel For Mails?

@DEANSATCH - i did start the supervisor and also removed sqs, it didnt work.

gouseferoz left a reply on Is It Good To Use Queue In Laravel For Mails?

@DEANSATCH - i have followed the supervisor installtion steps and configured it, and i dont see the queued jobs are getting executed. Am i doing anything wrong here?

gouseferoz left a reply on Is It Good To Use Queue In Laravel For Mails?

I just ran queue:work in my server instance. When i kept the linux terminal open, it was working. But when i closed it, it didnt work.

I was using digitalocean server instance for my laravel app.

gouseferoz started a new conversation Is It Good To Use Queue In Laravel For Mails?

Hi Guys,

I am new to the concept of Queuing in Laravel, I have implemented a sample asynchronous Queue for the mails to trigger in my app. But to see the Queuing work, I need to run

php artisan queue:work

to process all the queued jobs. I see that this artisan command should be running everytime on the server to have the queue work. Is this correct?

Or is there any other workaround for not to run the artisan command and make Queue work.

What is the difference between Queue and Listen, Which is better to use?

Regards, Feroz

20 Jun
3 weeks ago

gouseferoz left a reply on How To Fix Call To Undefined Method Illuminate\Session\Store::first() Error?

The issue is present even while submitting an empty form.

gouseferoz started a new conversation How To Fix Call To Undefined Method Illuminate\Session\Store::first() Error?

Hi,

I am trying to login into the laravel app using wrong password, which is giving

Call to undefined method Illuminate\Session\Store::first() 
C:\xampp\htdocs\Instacks\vendor\laravel\framework\src\Illuminate\Support\Manager.php
    /**
     * Get all of the created "drivers".
     *
     * @return array
     */
    public function getDrivers()
    {
        return $this->drivers;
    }
 
    /**
     * Dynamically call the default driver instance.
     *
     * @param  string  $method
     * @param  array   $parameters
     * @return mixed
     */
    public function __call($method, $parameters)
    {
        return $this->driver()->$method(...$parameters);
    }
}

How can i solve this issue?

Regards, Feroz.

18 Jun
3 weeks ago

gouseferoz left a reply on Email With Dynamic Content From Controller.

@WILK_RANDALL - This works perfectly. Thanks for the quick help :)

11 Jun
1 month ago

gouseferoz left a reply on Email With Dynamic Content From Controller.

@WILK_RANDALL - Thanks @wilk_randall , is it possible to provide an example. It would really help me.

gouseferoz started a new conversation Email With Dynamic Content From Controller.

Hi Guys,

I am trying to implement Emails for my laravel project, but dont know how to start.

I followed few tutorials out there and was able to trigger a mail.

I want to check how the I can send mails with dynamic data in its body which is pulled from the database.

Can anyone direct me to the right place which overlines these.

Regards, Feroz.

26 Apr
2 months ago

gouseferoz left a reply on "SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row

@MKBAT - That solves the problem.

I had few rows of data in data_text which has the **module_data.id **

and that id is not present in module_data.

25 Apr
2 months ago

gouseferoz left a reply on "SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row

@staudenmeir

Module Data Migration:

public function up()
    {
        Schema::create('module_data', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->unsignedInteger('module_id');
            $table->timestamps();
            $table->foreign('module_id')->references('id')->on('modules')->onDelete('cascade');
        });
    }

Modules Migration:

public function up()
    {
        Schema::create('modules', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->unsignedInteger('user_id');
            $table->timestamps();
        });
    }

gouseferoz started a new conversation "SQLSTATE[23000]: Integrity Constraint Violation: 1452 Cannot Add Or Update A Child Row

I have a table without any foreign key in it and i want to add a foreign key to have onDelete('cascade') between two tables.

public function up()
    {
        Schema::create('data_text', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id');
        $table->unsignedInteger('chapter');
            $table->string('data')->nullable();    
            $table->timestamps();
    });
    }

and my new migration is

public function up()
    {
        Schema::table('data_text', function (Blueprint $table) {
            $table->foreign('chapter')->references('id')->on('module_data')->onDelete('cascade');
        });

    }

while migrating, i am getting the following error

Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`in
stacks`.`#sql-d0_13b`, CONSTRAINT `data_text_chapter_foreign` FOREIGN KEY (`chapter`) REFERENCES `module_data` (`id`) ON DELETE CASCADE)")
      C:\xampp\htdocs\Instacks\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:119

  2   PDOException::("SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`instacks`.`#sql-d0_13b`
, CONSTRAINT `data_text_chapter_foreign` FOREIGN KEY (`chapter`) REFERENCES `module_data` (`id`) ON DELETE CASCADE)")
      C:\xampp\htdocs\Instacks\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:117

can anyone help me whats issue happening here?

Regards, Feroz

22 Apr
2 months ago

gouseferoz started a new conversation How To Have A Image Preview In The Light Box For Before Uploading In The Form

I am uploading images using the form however i wanted to see the preview of the image while uploading it.

I was able to achieve using that using jquery render, but the image sizes are small and i cannot display the whole image of its size on the page. So i thought of using lightbox.

I am using lightcase javascript library. When i use the below javascript code, I am getting 404 error in the popup where the image has to be loaded.

//HTML file
              <a id="questionImage" data-rel="lightcase">Preview</a>


//Jquery
$('body').on('change', '.imagepreview', function() {
    $imageid = $(this).attr('data-img');
    if (this.files && this.files[0]) {
    var reader = new FileReader();

    reader.onload = function (e) {
    // var image = new Image();
    // image.src = e.target.result;
      $("#"+$imageid).attr('href', e.target.result);
    };
    reader.readAsDataURL(this.files[0]);
  }
});

can anyone suggest what is the better approach for this?

Regards, Feroz.

08 Apr
3 months ago

gouseferoz left a reply on My Server Is Not Loading The Latest Files.

@KEVINC - no, i am not using any caching

07 Apr
3 months ago

gouseferoz left a reply on My Server Is Not Loading The Latest Files.

@SNAPEY - no i dont have any caching service.

However i renamed the view file and used the new file and it worked.

Not sure what is the root cause of it.

I did clear the view using artisan clear:view , it didnt work though

gouseferoz left a reply on My Server Is Not Loading The Latest Files.

@JLRDW - I did clear cache using php artisan cache:clear. But its of no use

06 Apr
3 months ago

gouseferoz started a new conversation My Server Is Not Loading The Latest Files.

Hey Guys,

I have a website on nginx server and today it is loading old content instead of new content.

I have checked the server and the content is new there. Dont know why it is behaving like this. It was alright till the evening.

Can any help me whats going on?

Regards,

29 Mar
3 months ago

gouseferoz left a reply on Foreign Key Constraint Incorrectly Formed.

@snapey when I ran the module_para first and then module_text later, I don't see this error.

gouseferoz left a reply on Foreign Key Constraint Incorrectly Formed.

@SNAPEY - First module_text is migrating and throwing error Foreign key constraint error.

Do I need to migrate module_para first?

28 Mar
3 months ago

gouseferoz started a new conversation Foreign Key Constraint Incorrectly Formed.

I am trying to add a foreign key cascade in migrations and for some reasons it is not working.

I tried to find the issue but no luck.

Schema::create('module_para', function (Blueprint $table) {
            $table->increments('id');
            $table->longText('module');
            $table->string('difficulty');
            $table->timestamps();
        });
Schema::create('module_text', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger("para_id")->default(0);
            $table->longText('explanation')->nullable();
            $table->timestamps();
            $table->foreign('para_id')->references('id')->on('module_para')->onDelete('cascade');
        });

Can you help me in resolving this issue?

24 Mar
3 months ago

gouseferoz started a new conversation Catching Exceptions While Importing An Excel File Using Maatwebsite

Hi Guys,

I am using maatwebsite to import the excel file and save the records in the database.

I was able to import them but I also want to add validations such as required|email and also want to catch the sql exceptions raised in between.

Below is my controller code.

public function import(Request $request)
    {
        $validateData = $request->validate([
            'class_id' => 'required'
        ]);
        try {
    $import->import(request()->file('usersExcel'), null , \Maatwebsite\Excel\Excel::XLSX);
    } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
         $failures = $e->failures();
         $errormessage = "";
         dd($failures);
         foreach ($failures as $failure) {
             $errormess = "";
             foreach($failure->errors() as $error)
             {
                 $errormess = $errormess.$error;
             }
             $errormessage = $errormessage." ,\n At Row ".$failure->row().", ".$errormess."<br>";
         }
         return redirect('/create_users')->with('error', $errormessage);

    }

    }

Here is the import code:

use Importable, SkipsErrors;
    private $classid = 0;
    public function __construct(int $classid)
    {
        $this->classid = $classid;
    }

    public function model(array $row)
    {

        return new User([
           'name'     => $row['name'],
           'email'    => $row['email'],
           'password' => Hash::make('password'),
           'user_role' => 'indirect',
           'admin_id' => auth()->id(),
           'class_id' => $this->classid,
           'regd' => $row['regd']
        ]);
    }

    public function rules(): array
    {
    return [
        'name' => 'required',
        'email' => 'required',
        'password' => 'required',
    ];
    }

My roadblocks here are, i can catch the row validations and send that to the view through the controller but not sure whether this is right code. And I am not able to handle the queryExceptions that i get if i insert duplicate record.

Can you guys help me figuring it out.

11 Mar
4 months ago

gouseferoz left a reply on Data From A Table Where Column 1 Equals To Column 2 Of The Same Row

@snapey whereColumn also works and I am using whereColumn instead of whereRaw as it make the code more readable.

08 Mar
4 months ago

gouseferoz started a new conversation Data From A Table Where Column 1 Equals To Column 2 Of The Same Row

Hi All,

I was trying to pull the data from a table where column 1 equals to column 2 of the same row.

I was using something like this,

Posts::where("name","<=>","author")->get();

but the above query is returning null.

Can you help me what i was doing wrong.

21 Feb
4 months ago

gouseferoz left a reply on Configuring Phpmyadmin On Nginx Server For Laravel

Thanks @cronix for the help.

I am moving forward by using remote mysql connections rather than having phpmyadmin on the server. The HeidiSql does exactly the work I need.

Again, Thanks for your help.

gouseferoz left a reply on Configuring Phpmyadmin On Nginx Server For Laravel

It is just to view the data in my database.

The above link is apache server but i am using Nginx server, I am not sure if there will be some difference in both servers configs.

20 Feb
4 months ago

gouseferoz started a new conversation Configuring Phpmyadmin On Nginx Server For Laravel

Hey Guys,

I was trying to configure phpmyadmin for my laravel application on nginx server.

After installing, i can see my phpmyadmin on /var/www/laravel/phpmyadmin

When i am doing domain/phpmyadmin, i am getting 404 error. This may be due to the routing.

How can i overcome this and point out the phpmyadmin with the url.

I appreciate your help.

Regards, Feroz.

18 Feb
4 months ago

gouseferoz left a reply on Unable To Connect To Database In Linux Server.

I have found workaround to my issue.

I have created another user in mysql and granted all permissions to it. When i use this username in my env file, I was able to connect to the db.

gouseferoz left a reply on Unable To Connect To Database In Linux Server.

even i have hard coded the values in database.php, but they are not working.

gouseferoz left a reply on Unable To Connect To Database In Linux Server.

I have done those, everything looks ok for me. The database.php is using the env variables .

If there is a problem with those, tinker wouldn't work right !!

17 Feb
4 months ago

gouseferoz started a new conversation Unable To Connect To Database In Linux Server.

I have just moved my project to a vps server and made changes to all my files.

The only problem i am facing is unable to connect to the database.

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

my env file:


DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=instacks
DB_USERNAME=root
DB_PASSWORD=123456

I tried using tinker and I was able to save data into the tables. I was also able to migrate my tables.

But is unable to connect to the databases when trying to load something from db onto the page.

Is there anything i am missing?

Regards, Feroz.

16 Feb
4 months ago

gouseferoz left a reply on Using Queries In Blade Templates

@TYKUS - Thanks @tykus for your help here. I will try and see if that works.