Jaikangam

Jaikangam

Member Since 1 Year Ago

Experience Points
9,750
Total
Experience

250 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
76
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 2
9,750 XP
Jun
29
4 months ago
Activity icon

Started a new Conversation Can I Host Three Laravel App On Single Droplet In Digital Ocean?

Hi, I have three laravel app and hosted different droplet which cost $5 each every month. My billed are $15 per month paying for digital ocean. Is there any way to reduce the cost. Installing three app on one Single Droplet. If possible please do suggest i am hungry to save some $.

Jun
11
5 months ago
Activity icon

Replied to Excel Import Date Format Issue .

thanks it work for me on the assign answer as best.

Activity icon

Started a new Conversation A Non Well Formed Numeric Value Encountered On Laravel Excel Package

Can someone help me i am using the laravel excel to import the excel file into Mysql. Error on the date

I am using maatwebsite package. ver 3.1 This is my Import

<?php

namespace App\Imports;

use App\User;
use Maatwebsite\Excel\Concerns\ToModel;

class UsersImport implements ToModel
{
    /**
    * @param array $row
    *
    * @return \Illuminate\Database\Eloquent\Model|null
    */
    public function model(array $row)
    {
        return new User([
            'name'     => $row[1],
            'email'    => $row[2], 
            'email_verified_at'    => \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[3]),
            'password'    =>  $row[4],
        ]);
    }
}

Error is on email_verified_at, i want excel date to be insert there I am not able to fetch the excel date to insert mysql. How do i need to do if you have successfully implemented.

May
30
5 months ago
Activity icon

Replied to Error On Sending Mail, Fwrite(): SSL: An Existing Connection Was Forcibly Closed By The Remote Host.

@BOBBYBOUWMANN - I am using the mailtrap for testing. and i am on the local development wamp server.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=***********my id 
MAIL_PASSWORD=***********my password
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=Example
Activity icon

Started a new Conversation Error On Sending Mail, Fwrite(): SSL: An Existing Connection Was Forcibly Closed By The Remote Host.

what will be the reason for this.

my controller

 public function store_contact( Request $request){
       $request->validate([
            'name'=> 'required',
            'email'=> 'required|email',
            'interested'=> 'required',
            'organization_type'=> 'required',
            'organization_name'=> 'required',
            'organization_type'=> 'required',
            'location'=> 'required',
            'message'=> 'required',
        ]);

    $data = array(
            'name'=> $request->name,
            'email' => $request->email,
            'interested'=>$request->interested,
            'organization_type'=>$request->organization_type,
            'organization_name'=>$request->organization_name,
            'location'=>$request->location,
            'message'=>$request->message
        );

    DB::table ('contacts')->insert ($data);

    
      Mail::send('email.contact', $data, function($message) use ($data)
      {
        $message->from($data['email'], $data['name'] );
        $message->to('[email protected]','Nishtha Chouhan');
        $message->subject('New Contact Enquiry');
      });


    return back();
May
23
5 months ago
Activity icon

Started a new Conversation How To Count The No Of Blog That Have Category With Match Id

Hi, Looking for solution i am building a blog, which is like wordpress blog I have two table posts and categories and i want to count blog and place that count no in categories index.

table1 = posts 
==================
id
category_id
title 
slug
body

table2 = categories
==================
id 
name 
slug

Final output to be like this on the categories index page

name       count 
=============
Laravel     2 ( means Laravel has 2 blog)
React        3
Vue           5 
JQuery      5 

Please do help some suggestion.

 public function index()
    {
        $countCateg = DB::table('blogs')->where('category_id', '4')->count();
         
    dd($countCateg); // here the count is giving 2.  which means category id 4 has 2.  

        $displays = Category::all();
        
       
        return view('backend.users.blog.catergory.index', compact('displays'));
    }

How do i pass that 4 dyanamic on this line where('category_id', '4')->count();

May
18
5 months ago
Activity icon

Replied to Laravel Voyager Admin Package Error

Thanks @bobbybouwmann it works now.

If someone finding for the same error like me this is the solution.

  1. Update the "config/database.php" for 'mysql'
'engine' => null,

change it to

'engine' => 'InnoDB ',

Update the "app/Providers/AppServiceProvider.php" with

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        // Specified key was too long error, Laravel News post:
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

for the Specified key was too long; max key length is 1000 bytes Error

And then Execute Command:

php artisan cache:clear
php artisan config:clear
php artisan voyager:install --with-dummy

its works now

May
17
5 months ago
Activity icon

Started a new Conversation Laravel Voyager Admin Package Error

hi i am getting error on this package, I have already made change on AppServiceProvider.php https://laravel-news.com/laravel-5-4-key-too-long-error

still getting error on translations table

 Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `translations` add unique `translations_table_name_column_name_foreign_key_locale_unique`(`table_name`, `column_name`, `foreign_key`, `locale`))
Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - Finally done thanks for the support till up to here, that what not the way to do it on the production server it assume... it is because of the Permission. Laravel doesnt allow to write into Public Folder.

hi Reader hope this work for you if you got the same error like me. how do i solve my problem. I was saving the image direct to the laravel public folder. Laravel doesnt allow that way.

You need to store the image on the storage Folder which is below the Route folder. And then later link the storage to public which is accessible by Public.

My controller

...
if($request->hasFile('webinarphoto')){
                 //Get file from the browser 
                 $path= $request->file('webinarphoto');
                 // Resize and encode to required type
                 $img = Image::make($path)->resize(500,500)->encode();
                 //Provide the file name with extension 
                 $filename = time(). '.' .$path->getClientOriginalExtension();
                //Put file with own name
                Storage::put($filename, $img);
                //Move file to your location 
                Storage::move($filename, 'public/webinar/' . $filename);
                //now insert into database 
                $inserts->webinarphoto = $filename;
        }
....
code continue 

Make a link to Public so that public can get access

php artisan storage:link 

And now on the blade view retrieve it using like

<img src="{{ asset('storage/webinar/'. $webinars->webinarphoto) }}" style="width:100px; height:100px; float:left; border-radius:8%; ">

Finally its work. Hope it solve the problem who have the same error like me finding for the solution. Happy Coding....

May
16
5 months ago
Activity icon

Replied to How To Give Permission To Public Folder To Store Image.

Hi If anyone Finding for the same solution like me. Saving image to public folder with using storage will definitely get an error #Can't write image data to path

Here is the code for reference if anyone facing the same like.

... 
if($request->hasFile('webinarphoto')){
    $path= $request->file('webinarphoto');    //Get file from the browser 
        $img = Image::make($path)->resize(500,500)->encode();  // Resize and encode to required type
               
        $filename = time(). '.' .$path->getClientOriginalExtension();  //Provide the file name with extension 
                
    //Put file with own name
        Storage::put($filename, $img);
        //Move file to your location 
        Storage::move($filename, 'public/webinar/' . $filename);
                
    //now insert into database 
        $inserts->webinarphoto = $filename;
}
.... 
code continue 

Image will be save to storage Folder which is below Route Folder. Make a link to Public so that public can get access

php artisan storage:link 

And now on the blade view retrieve it using

<img src="{{ asset('storage/webinar/'. $webinars->webinarphoto) }}" style="width:100px; height:100px; float:left; border-radius:8%; ">

Boom it is working... Hope Problem solve for getting error like this.

(1/1) NotWritableException
Can't write image data to path 
Activity icon

Replied to How To Give Permission To Public Folder To Store Image.

@ANDREICH1980 - Thanks come to know that it is not allow to access the public folder.

Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - Hi, Is that your code working fine is running on local or production. ? Changing the ownership of folder is not a good idea for Laravel. And it is not recommended it seems

Activity icon

Started a new Conversation How To Give Permission To Public Folder To Store Image.

Hi Developer,

Hope you are doing good. I am finding hard time to solve this. Please help me

I am form which accept image to insert into Database.

Controller to store image

...
if($request->hasFile('webinarphoto')){
     $file1 = $request->webinarphoto; //Image from the browser 
     $filename = time().'.'. $file1->getClientOriginalExtension(); //getting the extension an filename to save 
     $location = public_path('images/webinar/' .$filename); //setting the file location 

      Image::make($file1)->resize(500,500)->save($location); //Resize the file into 500x500 and save it into public folder 'images/webinar/filename.jpg' 
           
     $inserts ->webinarphoto = $filename; //finally insert the filename into database. 
 }
...

This work fine on the local development

But when i run on production it is giving me error

(1/1) NotWritableException
Can't write image data to path (/var/www/foldername/public/images/webinar/1557987359.jpg)

How do i solve this

Activity icon

Replied to Composer Laravel Installer Permission Denied On Windows 10

are you on local or production server?

Activity icon

Replied to Upload Image Not Saved At Directory On Server Laravel 5.8

@SNAPEY - I am having the same problem. Upload image error say Can't write image data to path this seem to be permission problem how to solve it.

Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - thanks It works on the local but not in the staging server/production. I dont know how can i solve it.

(1/1) NotWritableException
Can't write image data to path (/var/www/foldername/public/images/webinar/1557987359.jpg)

This is to be folder permission problem i assume to be.

May
15
5 months ago
Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - ooh no then i cant do that for security reason. when i give permission to Folder, high chance to be hack.

https://www.itechempires.com/2017/06/laravel-5-files-folders-permission-ownership-setup/

then how people use Intervention Image Package. I wonder

$location = 'images/webinar/' .$filename;
$image->resize(500,500)->save($location);

Error still remain the same bro. How do you use the Intervention image package. http://image.intervention.io/

Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - how do i change folder ownership to self.

I am referring to this article but i didnt get it clearly. https://stackoverflow.com/questions/30639174/how-to-set-up-file-permissions-for-laravel-5-and-others

Please seem to be you have a clear concept on it. please do explain and even it will be helpful for other who is finding for the same solution.

Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

This code work fine on the local development server. But on the production it is giving error.

if($request->hasFile('webinarphoto')){
            $file1 = $request->webinarphoto; //Image from the browser 
            $filename = time().'.'. $file1->getClientOriginalExtension(); //getting the extension an filename to save 
            $location = public_path('images/webinar/' .$filename); //setting the file location 

            Image::make($file1)->resize(500,500)->save($location); //Resize the file into 500x500 and save it into public folder 'images/webinar/filename.jpg' 
           
            $inserts ->webinarphoto = $filename; //finally insert the filename into database. 
          }

This above code is working fine on the local. On the Production it is giving error.

(1/1) NotWritableException
Can't write image data to path (/var/www/foldername/public/images/webinar/1557919683.png)

in Image.php line 143
at Image->save('/var/www/foldername/public/images/webinar/1557919683.png')
in PostWebinarController.php line 62

Is this because of Permission. Someone please help. How to make the file writable

Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - Sorry, cant mark as best answer. Error again

Intervention \ Image \ Exception \ NotReadableException
Image source not readable
Activity icon

Replied to Can't Write Image Data To Path In Production Server [Interverntion Image ]

@MAVERICKCHAN - how the final code will look like. can you please edit my code. Do i need to remove the $location or.Please edit my code. Will be very grateful to you

Activity icon

Started a new Conversation Can't Write Image Data To Path In Production Server [Interverntion Image ]

It work on the local server. But on the production it gives can't write image data to path. how can is solve this problem.

Controller to save Image


         if($request->hasFile('webinarphoto')){
            $file1 = $request->webinarphoto;
            $filename = time().'.'. $file1->getClientOriginalExtension();
            $location = public_path('images/webinar/' .$filename);
            //Image / Webinar should have folder in the public
            Image::make($file1)->resize(500,500)->save($location);
           
            $inserts ->webinarphoto = $filename;
          }