Nagraj722

Nagraj722

Member Since 7 Months Ago

Experience Points 1,290
Experience Level 1

3,710 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 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

18 May
1 day ago

Nagraj722 left a reply on How To Set .active With Laravel In Css?

Below code add active class for first slide. hope this code helps you.

            <div class="carousel-inner">
                @foreach($slideshows  as $key=>  $slideshow)
                    <div class="carousel-item  {{$key == 0 ? 'active':''}}">
                        <img src="images/slideshows/{{ $slideshow->image }}" class="d-block w-100">
                        <div class="carousel-caption d-none d-md-block">
                            <h5>{{ $slideshow->title }}</h5>
                            <p>{!! str_limit($slideshow->body, 50) !!}</p>
                        </div>
                    </div>
                @endforeach
            </div>
19 Feb
3 months ago

Nagraj722 left a reply on Laravel Relationship Suggestion

@snapey and @cronix - thanks for your suggestion. i have did this with using pivot table.

Nagraj722 started a new conversation Laravel Relationship Suggestion

Hi.. i need a suggestion, i have a two tables articles and authors. my scenario is every article have more then one author. My problem is, how to get author data with article. i know the solution with belongsToMany relationship with pivot table. is there any solution without use pivot table. Thanks..

Article_table

| id | title | author_id |

| 1 | title 1 | 1,2 |

| 2 | title 2 | 3,4,5 |

Authors_table

| id | name |

| 1 | name 1 |

| 2 | name 2 |

| 3 | name 3 |

| 4 | name 4 |

18 Feb
3 months ago

Nagraj722 left a reply on Get All The Records By Using Explode

You can add id's to array like

   foreach ($students as $student) {
                $studentData=[];
        // $data[$studentId] = [];
          $studentData['id'] = $student->id;
                $studentData['roll_nuber'] = $student->roll_number;
                $studentData['first_name'] = $student->first_name;
                $studentData['last_name'] = $student->last_name;
                $studentData['gender'] = $student->gender;
                $studentData['graduated_year'] = $student->graduated_year;
                array_push($data, $studentData);
            }

and change news table to students table

Nagraj722 left a reply on How To Solve This? Undefined Offset: 0 (View:)

Try to check with dd($user) what are the data getting

@foreach($users as $user)

dd($user)

@endforeach

Nagraj722 left a reply on Get All The Records By Using Explode

I just ran this code on my local system with different table... it's working good for me

{
"success": true,
"data": [
{
"roll_nuber": 4,
"first_name": "FDA Approves MEDICREAs K-JAWS(R",
"last_name": null,
"gender": null,
"graduated_year": null
},
{
"roll_nuber": 5,
"first_name": "Berlin Heart Completes Enrollment in the EXCOR Pediatric Ventricular Assist Device (VAD) Post Approval Study",
"last_name": null,
"gender": null,
"graduated_year": null
},
{
"roll_nuber": 6,
"first_name": "Futura Mobility Enters into Telemedicine Partnership with REACH Health",
"last_name": null,
"gender": null,
"graduated_year": null
},
{
"roll_nuber": 7,
"first_name": "Harvard SEAS Engineers Develop Portable NMR Spectrometers",
"last_name": null,
"gender": null,
"graduated_year": null
}
]
}

Try to ran below code once

 if(!$ids) 
            return "Please enter a valid student id";

        $studentIds = explode(':', $ids);

        $students = News::whereIn('id', $studentIds)->get();
        $data = [];
        if(!$students){
            return "No Students are found with this . '$studentId' .";
        }else{

            foreach ($students as $student) {
                $studentData=[];
        // $data[$studentId] = [];

                $studentData['roll_nuber'] = $student->roll_number;
                $studentData['first_name'] = $student->first_name;
                $studentData['last_name'] = $student->last_name;
                $studentData['gender'] = $student->gender;
                $studentData['graduated_year'] = $student->graduated_year;
                array_push($data, $studentData);
            }
        }

        return response(['success' => true, 'data' => $data], 200);

Nagraj722 left a reply on Get All The Records By Using Explode

You should add $data = []; before foreach

Nagraj722 left a reply on Get All The Records By Using Explode

change below line

  $students = Student::whereIn('id', $studentId)->get();

to

  $students = Student::whereIn('id', $studentIds)->get();

Nagraj722 left a reply on How To Solve This? Undefined Offset: 0 (View:)

Try below code

@foreach($users as $user)

{{$user->first()->last_name}},{{$user->first()->first_name}},{{$user->first()->middle_name}}

@endforeach

17 Feb
3 months ago

Nagraj722 left a reply on Get All The Records By Using Explode

Try below code...

public function getStudents($ids)
{   
    if(!$ids) 
        return "Please enter a valid student id";

    $studentIds = explode(':', $ids);

    $students = Student::whereIn('id', $studentId)->get();

    if(!$students){
        return "No Students are found with this . '$studentId' .";
    }else{
    
    foreach ($students as $student) {
        $studentData=[];
        // $data[$studentId] = [];

        $studentData['roll_nuber'] = $student->roll_number;
        $studentData['first_name'] = $student->first_name;
        $studentData['last_name'] = $student->last_name;
        $studentData['gender'] = $student->gender;
        $studentData['graduated_year'] = $student->graduated_year;
        array_push($data, $studentData);
    }
    }
    return response(['success' => true, 'data' => $data], 200);
}

05 Feb
3 months ago

Nagraj722 left a reply on How To Get Name From Category Id

You can simply access category name with below example code.

 @foreach ($media as $results) 

    {{ $results->category->name }} 

@endforeach 
04 Feb
3 months ago

Nagraj722 left a reply on How To Get Name From Category Id

You need to write relations like below code

Media.php

public function categories(){
    return $this->belongsToMany('App\Category');

  }

@foreach ($media as $results)
    {{ ++$cnt }} {{ $results->categories->name }} 
    {{ $results->title }} {{ $results->url }} 
    {{ $results->type }}
@endforeach
29 Jan
3 months ago

Nagraj722 left a reply on Phone Number And Company Name From LinkedIn With Laravel Socialite.

@THAMINK - controller code

 public function redirectToProvider($provider)
    {
      
        return Socialite::driver($provider)->redirect();
    }


 public function callback($provider)
    {

         $slug = \Cookie::get('page_no');           

         try {

            $user = Socialite::driver($provider)->user();           
            dd($user);
          
            }
        }catch (Exception $e) {
            return $this->sendFailedResponse($e->getMessage());
        }
    }

Nagraj722 started a new conversation Phone Number And Company Name From LinkedIn With Laravel Socialite.

i didn't get phone and company name from linkedin. i am using laravel socialite package. anyone help me.

25 Jan
3 months ago

Nagraj722 left a reply on Redirect To External Url With Form Data From Controller

I have done wit js

    var url = "{{ url('contactus') }}";
      function OnButton1(){
        document.contactus_form.action ="https://externalsite/page.php";
          document.contactus_form.submit();      
        setTimeout(function(){
        

        document.contactus_form.action = url;
        document.contactus_form.submit();  
        },200);
      }

here im using setTimeout function, it's working but sometimes not working due to the server load time. that's why im searchin another solution i.e, submit second action from controller.

Nagraj722 left a reply on Redirect To External Url With Form Data From Controller

@TISUCHI - Thanks @tisuchi, The external web site is not an API. Actually, I need to store form data on two websites one is mine another is different. First, I'm stored data on my website than trying to send form data to the external site. can suggest me any alternative solution for this.

Nagraj722 started a new conversation Redirect To External Url With Form Data From Controller

I need submit a form to external website from the controller. can anyone help me.

I have tried below code but not succeed.

Redirect::to('https://externalwebsite.com/page.php')->withInputs($request->all());

Thanks,

11 Jan
4 months ago
10 Jan
4 months ago

Nagraj722 started a new conversation Where Condition Case Insensitive On Eager Loading

How to write a query for case insensitive on relationship

  $products = Product::where('category_id',$category->id)->where('active_flag',1)->distinct()->get(['company_id']);


      $data =  $products->load('company')->where('company.country','like', '%'.$country . '%');
09 Jan
4 months ago

Nagraj722 left a reply on Keep Modal Open If Form Has Errors?

Hope below code helps you...

@if($errors->any()) <script type="text/javascript"> $(document).ready(function(){ $('#modal_name').modal('show'); }); </script> @endif

04 Jan
4 months ago

Nagraj722 left a reply on Route Suggestion

@S4MUEL - working perfect. Thank you so much...

Nagraj722 started a new conversation Route Suggestion

I need a route like Route::get('{category}-suppliers-{country}',function($supl, $data){ return 'Done'; });

Here my problem is, category should be slug like "abc-efgh-ijkl" http://localhost/laravel/abc-efgh-ijkl-suppliers-usa

please suggest me any way to do that or else any other solutions without using '/' like http://localhost/laravel/abc-efgh-ijkl/suppliers/usa

Thanks,

20 Dec
4 months ago

Nagraj722 left a reply on Get The Value Of Select Box With Same Class

Try this

   @foreach($test as $t)
   <button id="id_{{$t->id}}" class="choose_btn">Choose</button>

   <select name="select_test" id="select_id_{{$t->id}}">
    <option value="0">0</option>
    <option value="1">1</option>
  </select>
   @endforeach

 $('.choose_btn').on('click', function() {
        var select_selector = '#select_'+$(this).attr('id');
        var select = $(select_selector).val();
        alert(select);
      });
19 Nov
6 months ago

Nagraj722 left a reply on Create An Object[]

Try this

 $products = [
        
            "SellerPersonType" => 1,
            "SellerName" => "Carlos",
            "SellerTaxNumber" => 11122233300,
            "ReceiverPersonType" => 0,
            "ReceiverName" => "Caio",
            "ReceiverTaxNumber" => 11122233300
        
    ];
03 Nov
6 months ago

Nagraj722 left a reply on Laravel 5.6 Shows Old Whoops Page

Yes..... you are right..... but my problem is getting old whoops page.

02 Nov
6 months ago

Nagraj722 left a reply on Desktop Share With Laravel

Thanks for your suggestion... @munazzil but i want to integrate any third party app with my laravel application.

Nagraj722 started a new conversation Desktop Share With Laravel

I want to know is it possible to do desktop share application with laravel framework. It means web cam and desktop share.

Thanks.

16 Oct
7 months ago

Nagraj722 left a reply on Call To A Member Function Where() On Integer

$user = $request->assigned_to; $userName = $user->where($user, auth()->user()->id)->pluck('name'); $user contains 'assigned_to' value only. you can not perform where condition on that. and where($user, auth()->user()->id) here $user should be string like field name but in your coding $user integer.

11 Oct
7 months ago

Nagraj722 started a new conversation Download A File After Form Submission Laravel 5.6

i want to download a file after successful form submission.

return redirect()->route('form.success')->download($pathToFile);

Thanks

Nagraj722 left a reply on Laravel 5.6 Shows Old Whoops Page

You are right...! but in production mode i'm getting some errors... so that am changing to APP_DEBUG = true

10 Oct
7 months ago

Nagraj722 left a reply on I Got This Error While Sending Mail

Need to pass data to UserMail file. /code

namespace App\Mail;

class UserMail extends Mailable { use Queueable, SerializesModels; public $data; /** * Create a new message instance. * * @return void */ public function __construct($data) { $this->data = $data; }

/**
 * Build the message.
 *
 * @return $this
 */
public function build()
{
     return $this->from('[email protected]')
                
                ->view('emails.userMail');
}

}

Nagraj722 left a reply on I Got This Error While Sending Mail

Need to pass data to UserMail file.

Nagraj722 started a new conversation Laravel 5.6 Shows Old Whoops Page

I'm using laravel 5.6, while getting any error it's displays old error page like 5.4 Error image. but on localhost it's work good.