Jaikangam

Jaikangam

Member Since 1 Year Ago

Experience Points 9,750
Experience Level 2

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.

29 Jun
2 months ago

Jaikangam 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 $.

11 Jun
3 months ago

Jaikangam left a reply on Excel Import Date Format Issue .

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

Jaikangam 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.

30 May
3 months ago

Jaikangam left a reply on 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

Jaikangam 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();
23 May
3 months ago

Jaikangam 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();

18 May
4 months ago

Jaikangam left a reply on 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

17 May
4 months ago

Jaikangam 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`))

Jaikangam left a reply on 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....

16 May
4 months ago

Jaikangam left a reply on 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 

Jaikangam left a reply on 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.

Jaikangam left a reply on 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

Jaikangam 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

Jaikangam left a reply on Composer Laravel Installer Permission Denied On Windows 10

are you on local or production server?

Jaikangam left a reply on 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.

Jaikangam left a reply on 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.

15 May
4 months ago

Jaikangam left a reply on 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/

Jaikangam left a reply on 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.

Jaikangam left a reply on 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

Jaikangam left a reply on 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

Jaikangam left a reply on 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

Jaikangam 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;
          }
27 Apr
4 months ago

Jaikangam started a new conversation Default Register Route To Put Middleware. How To Do It

Hi Dev, I have a role superadmin, admin and user. And also i have middleware for three of them. and now i want to access the default register page only to middleware superadmin. Please help

Jaikangam left a reply on I Want To Have Middleware On Register The Default Auth. How Do I Do Please Help

Even try on the traits but seem it is not the right way

trait RegistersUsers
{
    use RedirectsUsers;

    /**
     * Show the application registration form.
     *
     * @return \Illuminate\Http\Response
     */
   

    public function showRegistrationForm()
    {
        return view('auth.register')->middleware('auth','superadmin');
    }

Jaikangam left a reply on I Want To Have Middleware On Register The Default Auth. How Do I Do Please Help

@PHPHUPPTECHNOLOGIES - hi but its doesnt work.

Route::get('register','[email protected]')

it is not the default auth

Jaikangam started a new conversation I Want To Have Middleware On Register The Default Auth. How Do I Do Please Help

I have make an authentication and create the multi login with role.

Now i want the default register route to have access only to superadmin. What can i do that.
09 Apr
5 months ago

Jaikangam left a reply on [caching_sha2_password] Error When Running Php Artisan Migrate

I was getting error in the production server while php artisan migrate

In connection.php line: 664

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from information_schema.tables whe re table_schema = prod and table_name = migrations)

In connection.php line: 70 SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

After running the @mibou520 comment on myslq it is working fine for me. Thanks ...

25 Jan
7 months ago

Jaikangam started a new conversation Npm Run Watch Stop Working While Npm Run Dev Work, How I Can Make It Work It Again Npm Run Watch

hi developer, i am using laravel mix, i have being using npm run watch it is working fine. after i install one package its stop working while npm run dev is working fine. What is the reason for npm run watch stop working. The error is so painful cant understand #laravelmix

help if you come across like this. To make it work again the npm run watch.

24 Jan
7 months ago

Jaikangam started a new conversation How Can I Use Jquery For One Component In Vue ?

hi developer, I have old project that use jquery particle.js in the home background image. I am shifting to vue js. on the home component i want to implement the same particle.js. how can be implemented??

Jaikangam left a reply on Can We Use Jquery On Vue Js Application ?

@import '~bootstrap/scss/bootstrap';

this is how the default import. where should i place the themeforest css. will be on the public folder or resource folder. ?? any demo example please... will be thankful

Jaikangam started a new conversation Can We Use Jquery On Vue Js Application ?

Hi Developer, I have use Jquery on my old project and now i want to switch it to Vue js. i have use themeforest template and the css file come around 5 to 6 file. so

  1. how do i add (import) css file into sass in the resource/sass. and where do i keep my css file. is it on the public or the resource folder.

  2. i have implemented particle js on home background image which is use jquery and now how do i convert it to vue js.

19 Jan
7 months ago

Jaikangam started a new conversation How To Add Themeforest Custome Css File In The Resource/asset/sass File ?

Please help how do i add the css file in the resource folder to be use for vue front end.

Jaikangam started a new conversation How Do I Add Theme Template Css And Js In The Laravel And Vue ?

Need help badly, i add theme template css and js in the public folder. Want to use those as vue.

<p> i added vue js 
<link href="/css/app.css" rel="stylesheet">
 <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
</p>

and add

<div id="app"> 
// html here 
</div>

in the body. It break my css. How do i solve it please help

29 Nov
9 months ago

Jaikangam left a reply on Laravel 5.3 Passport Unsupported Grant_type

I got the similar error. How i did solve was My route: http://localhost:8000/oauth/token Under the Body> raw { "grant_type" : "password", "client_id" : "2", "client_secret" : "1hR6PoljOmvJNzee1n052FKsk0LYFyPSfYmWygLQ", "username" : "jaikangam12@gmail.com", "password" : "123456"

} I was try like this but got the error so change into body>form-data. Filled up the same key and value and it works now.

Watch reference here https://www.youtube.com/watch?v=isTZTfJV0-I&t=736s video timing at 12:20

28 Nov
9 months ago

Jaikangam started a new conversation What Is The Different Between Passport, Jwt, Auth0, Sociallite ??

I am full confuse seem to be all similar, when to use it all this i can figure out. Jwt is for authentication the mobile app? is it like that passport for social login like facebook , github and more. And socialite for social auth. What is the different between sociallite and passport? they seem to have same functionality. Can someone explain this four topic in brief.... Thanks.......

21 Nov
9 months ago

Jaikangam left a reply on Laravel Old Input Messing With Bootstrap Textarea

@ROCKHOPPER72 - nothing working bro. it is getting old('remarks') instead if the last inserted value

20 Nov
9 months ago

Jaikangam started a new conversation How To Retrive The Json Data Array And Print That Value? In Vue And Axios.

hi buddy In my vue application. i find difficult to take out the json data and print that value. i m not able to do it. Please if you know how to print it. In my vue app using axios for https request. This is my country pincode api http://postalpincode.in/api/pincode/797112 and on the postman app my jason data are

 "Message": "Number of Post office(s) found: 12",
    "Status": "Success",
    "PostOffice": [
        {
            "Name": "Dimapur",
            "Description": "",
            "BranchType": "Sub Post Office",
            "DeliveryStatus": "Delivery",
            "Taluk": "Dimapur",
            "Circle": "Dimapur",
            "District": "Dimapur",
            "Division": "Nagaland",
            "Region": "North Eastern",
            "State": "Nagaland",
            "Country": "India"
        },
        {
            "Name": "Doyapur",
            "Description": "",
            "BranchType": "Branch Post Office",
            "DeliveryStatus": "Delivery",
            "Taluk": "Dimapur Mdg",
            "Circle": "Dimapur Mdg",
            "District": "Dimapur",
            "Division": "Nagaland",
            "Region": "North Eastern",
            "State": "Nagaland",
            "Country": "India"
        }, 
and more......

How do i get that name , state and country to print it in the view

axios.get('https://postalpincode.in/api/pincode/' + app.startingZip)
                .then(function (response) {
                  app.startingCity = response.data.PostOffice.Name + ',' response.data.PostOffice.state + ',' + response.data.PostOffice.country
                })
                .catch(function (error) {
                  app.startingCity = "Invalid Zipcode"
                })

those json data are under the array so i am not able to do it. I want to store the startingCity value as Dimapur, Nagaland, India. please help if you can will be very thankful to you...

19 Nov
9 months ago

Jaikangam started a new conversation How To View The Inserted Pdf From The Form?

hi buddy i have inserted the pdf from the form upload and now i want to view the upload pdf. how do i do, need your help badly, Please some link of blog or youtube tutorial if you find camp across the best.

my pdf file is selected upload and it is in under public folder. I try to view it like image but not working. Help please

13 Nov
10 months ago

Jaikangam left a reply on How To Pass Foreign Key For Edit Instead Of Default Id?

@TAKDW - thanks for the clue, it is working.

Jaikangam started a new conversation How To Pass Foreign Key For Edit Instead Of Default Id?

Hi developer need your help badly.

I have two table Sale table (main table) and Service Table (if he choose the service save it) on the Service table there is sale id (foreign key).

eg. From the index listing ID =8 is passing for edit to the route

on the case of this on services table i have id = 5, sale_id = 8 something data

Controller below
    public function edit($sale_id)
    {
        View::share(['page_name_active'=> 'sam_listsales']);
        $newvar =  Service::findOrFail($sale_id);
        $servicesarray = $newvar->services;
       
       
        return view('sales.manager.services_edit', compact('newvar', 'servicesarray'));
    
    }

Try this by those not work

Route::get('/sales/manager/services/edit/{sale_id}','SAM\[email protected]')->name('services.edit');

How can i edit the service where the id doesnt not match, i want to get service by foreign key

Help Please
09 Nov
10 months ago

Jaikangam left a reply on Cross-env Not Found On Npm Run Dev

Me installing normal without laragon or Virtual host. after the hours of research i found the solution. here is how i did

  1. npm install cross-env -g
  2. npm install --save

after that npm run dev or npm run build Boom! Laravel Mix Build Successful it is working.....

Jaikangam started a new conversation How To Check The CheckBox In The Modal Where Data Is Passing By Ajax.

hi buddy i am finding for the solution for Editing the Data, where my code is using ajax and bootstrap modal. The DB data is successful pass to the edit Modal form but the checkbox is not check. How can i solve this, need your help badly

 function editForm(id) {
          save_method = 'edit';
          $('input[name=_method]').val('PUT');
          $('#edit_modal-form form')[0].reset();

          $.ajax({
            url: "{{ url('/sales/manager/leadslistmanager') }}" + '/' + id + "/edit",
            type: "GET",
            dataType: "JSON",
            success: function(data) {
              $('#edit_modal-form').modal('show');
              //$('.modal-title').text('Edit Lead Details');
              $('#id').val(data.id);
              $('#ClientName').val(data.client_name);
              $('#inputlocation').val(data.location);
              $('#FirstVisitDate').val(data.firstvisitdate);  
              $('#MobileNo').val(data.mobile_number);
              $('#AlternateContactNo').val(data.mobile_number_alternate);
              $('#Email').val(data.email);
              $('#Occupation').val(data.occupation);
              
              //This is the checkBox value that wanted to be check in the edit form 
              $('#IsInternetUser').val(data.isinternetuser);
              
              $('#CurrentInternetProvider').val(data.provider_ifinternetuser);
              $('#inputAddress').val(data.address);
              $('#Remarks').val(data.remarks);
            },
            error : function() {
              alert("Something Error on  Data");
            }
          });
        }



Blade Form View below

                  <div class="col-md-6">
                    <div class="form-group">
                      <label>Is Internet User?</label>
                        <div class="checkbox checkbox-switch">
                          <label>
                            <input type="checkbox" id="IsInternetUser"  value="1"  name="is_internet_user" onclick="myFunction()" >
                          </label>
                        </div>                                                      
                    </div>
                  </div>

How can i make it checkBox if IsInternetUser is true. I am not able to make the decision on the ID.

15 Oct
11 months ago

Jaikangam left a reply on How To Get Selected The Array Value In The Form Multi Select Option While Editing The Form?

hooo yea what i am getting is not an array

 $servicesarray = Service::where('sale_id', $id)->select('services')->get();
change to 
 $servicesarray = Service::where('sale_id', $id)->select('services')->get()->toArray();

Finally solve thanks..

10 Oct
11 months ago

Jaikangam started a new conversation In_array() Expects Parameter 2 To Be Array, Object Given In Laravel Multi Select Option

hi How to solve this case, I have an array data coll $servicesarray which contain the inserted value from the user. Now i want to edit the array in the form multi select bootstrap

But i am getting the error Please look into my case

 public function edit($id)
    {
        $sales =  Service::find($id);
        $servicesarray = Service::where('sale_id', $id)->select('services')->get();
      
        //dd($servicesarray) is getting the value selected  from the form in the view. 
    // ["BR","WD", "WH"] Inserted value in the table 
        
        
        return view('sales.manager.services_edit', compact('sales', 'servicesarray'));
    
    }

pass the $servicesarray in the view form

<select multiple required="" name="services[]" id="services" class="form-control listbox-no-selection">   
                   
               

                <option value="BR" <?php if (in_array("BR", $servicesarray)) {
   echo "selected";
} ?>  >Broadband   </option>

                  <option value="DF" >  >Dark Fiber</option>
                <option value="LL"  >Leased Lines</option>      
                <option value="IP"  >Static IP</option>
                <option value="WD"  >Website Domain</option>
                <option value="WH"  >Website Hosting</option>       
      
              </select>

This is the error message

ErrorException (E_ERROR) in_array() expects parameter 2 to be array, object given (View: D:\Developer Drive\Codding Ground\Symbios Creation Pvt Ltd\Apple\AppleLaravel2\resources\views\sales\manager\services_edit.blade.php)

Jaikangam started a new conversation How To Get Selected The Array Value In The Form Multi Select Option While Editing The Form?

I am getting a problem and i cant find the solution to solve it. Please Help me if you can will be really thankful to you.

<input type="hidden" name="_token" value="{{ csrf_token() }}">
            <div class="panel-body"> 

              <select multiple required="" name="services[]" id="services" class="form-control listbox-no-selection">   
               @foreach ($servicesarray as $object)        
                <option value="BR"  {{ $object === 'BR' ? 'selected' : '' }}>Broadband  </option>
                <option value="DF"   >Dark Fiber </option>        
                <option value="LL"  >Leased Lines</option>      
                <option value="IP"  >Static IP</option>
                <option value="WD" >Website Domain</option>
                <option value="WH" >Website Hosting</option>       
              @endforeach
              </select>
              <br>
              <p>
                Hint : Ctrl + Left click for multiple select
              </p>
            
          </div>
         
          <input type="text" name="customername" id="customername" class="form-control" required placeholder="Enter Name " value=" {{ $servicesarray }} " readonly="">

For testing i make a form input value ={{ $servicesarray}}. The value out there is [{"services":["BR","WD","WH"]}]

public function edit($id)
    {
        $sales =  Service::find($id);
        $servicesarray = Service::where('sale_id', $id)->select('services')->get();
        
        //dd($servicesarray) is getting the value selected  from the form in the view. 
        
        
        return view('sales.manager.services_edit', compact('sales', 'servicesarray'));
    
    }

What i want the result is to get value of selected in the select option So that i can edit it the value.

Jaikangam left a reply on How To Write Code In Laracast?

Testing testing 
08 Oct
11 months ago

Jaikangam left a reply on Inserting Data To User

Check in the model add the $fillable ="role_id", make sure that you made a relationship between role and user.

Jaikangam left a reply on Namespace Declaration Statement Has To Be The Very First Statement

Thanks i too have a whitespace before <?php Remove the whitespace before <?php Run its works fine now....