Nagraj722

Nagraj722

Member Since 10 Months Ago

Experience Points 1,580
Experience Level 1

3,420 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 1
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.

25 Jun
1 month ago

Nagraj722 left a reply on Names With Special Fonts Saved As Empty Value

i think problem related to UTF-8 character encoding. check your database table collection type and change to utf8mb4_general_ci

21 Jun
2 months ago

Nagraj722 left a reply on Form POST Not Working

it's working without attributes. i just removed style attribute from ul tag it's working good.

 <ul style="list-style-type:square">

to

 <ul>
...
...
</ul>

Nagraj722 left a reply on Form POST Not Working

@ajithlal - Thanks, i think problem is not related to database, i just returns the post data.

Nagraj722 left a reply on Form POST Not Working

@ejdelmonico i have tried with your code but no luck. @sergiu17 my controller code

public function store(Request $request)
{
        return  $request->all();
}
20 Jun
2 months ago

Nagraj722 started a new conversation Form POST Not Working

I am trying to submit a form, form contains one textarea field. the problem is if i fill form with html tags not submitted page redirected to back ( http://www.example.com/products/create to http://www.example.com/products).

if i enter normal content form working well.

create.blade.php

 {!! Form::open(array('route' => 'companies.store','files'=>true)) !!}
<div class="form-group">
                    {!! Form::label('name', 'Company Name:') !!}
                    {{ Form::input('text', 'comp_name', null, ['class' => 'form-control','required'=>'required']) }}
 </div>
<div class="form-group">
                    {!! Form::label('address', 'Address:') !!}
                    {{ Form::textarea('address', null, ['class' => 'form-control','rows'=>'3']) }}
  </div>
  <button type="submit" class="btn btn-sm btn-primary">Create</button>
</form>

Filled textarea field with

<div class="row PAD-10">
    <div class="col-md-4 col-sm-offset-2">
        <ul style="list-style-type:square">
            <li>Automation</li>
            <li>Lighting controls & solutions</li>
            <li>LEDs</li>
            <li>Controlling systems</li>
            <li>Lasers & fibre optics</li>
            <li>Metalhalide lights</li>
            <li>Stabilizers & starters</li>
        </ul>
    </div>
    <div class="col-md-6">
        <ul style="list-style-type:square">
            <li>Display technologies</li>
            <li>Flash lights, torches and batteries</li>
            <li>New & renewable energy</li>
            <li>Power generation</li>
            <li>Holders, Sockets & transformers</li>
            <li>Grid Technology</li>
            <li>Equipment & Accessories</li>
        </ul>
    </div>
</div>

How can i solve this issue. please help me.

Thanks in advance

18 May
3 months 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
6 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
6 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 run 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
6 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
6 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
6 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
6 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
6 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 anyone 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 and method should be POST. 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
7 months ago
10 Jan
7 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
7 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
7 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
8 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
9 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
9 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
9 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
10 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
10 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
10 months ago

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

Need to pass data to UserMail file.

namespace App\Mail;

public function __construct($user)
{
    $this->user= $user;
}


public function build()
{
     return $this->from('[email protected]')
                
                ->view('emails.userMail');
}

Nagraj722 started a new conversation Laravel 5.6 Shows Old Whoops Page

I have an issue on production server. 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.