jeetdholakia

jeetdholakia

Member Since 3 Years Ago

Mumbai

Experience Points 3,300
Experience Level 1

1,700 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 14
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.

08 Aug
2 years ago

jeetdholakia left a reply on Lock Screen Middleware

@jezzdk I tired the code but not working for me. If u can share the tutorial.

07 Jul
3 years ago

jeetdholakia left a reply on Get Data Using Relationship In Eloquent

@Hawkleaf Thanks for the reply. I know I'm confused regarding Query builder and Eloquent. Societyid comes from logged in user. Will surely cover some other tutorials to improve knowledge of laravel.

jeetdholakia started a new conversation Get Data Using Relationship In Eloquent

Hello, I am stuck with a query on my project. I have total 3 models: User, Member and Payment. User model: user_id,name, etc Member model: member_id,user_id, etc Payment model: payment_id,member_id,month_name, etc I want to fetch all the payment for month_name for lets say User X.

User Model:

public function member()
    {
        return $this->has_many('App\Member', 'userid', 'userid');
    }

Member Model:

public function user()
    {
        return $this->belongsTo('App\User', 'userid', 'userid');
    }

    public function payment()
    {
        return $this->has_many('App\Payment', 'memberid', 'memberid');
    }

Payment Model:

public function member()
    {
        return $this->belongsTo('App\Member', 'memberid', 'memberid');
    }

Query I am trying:

Payment::select('june')->member()->where('societyid', '=', $societyid)->get();
30 Jun
3 years ago

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac That column_name is in User table.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac I havent defined relationship in user model for memebers. Basically there are 3 models. Users, Members and Payment. Users have list of societies, Members have Every member details of all societies and payments have details related to payments of members. In Payment table I am storing member id. In Member I am storing User Id for relations.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac Code for member:

class Member extends Model
{
    public function user()
    {
        return $this->belongsTo('App\User', 'societyid', 'societyid');
    }
}

My $id is in Members table and Payment column is in Users table.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac I already have it in my models. Can u tell me how to incorporate in controller? please.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac Ok but my $id is in different table and payment column is in different table.

$main = User::find($id-TABLE1)->get(['column_name-TABLE2']);

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac This will work for that user. Suppose Admin is handling and he wants to add payment for other users.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac : I storing users information in table. While registering user selects the option to go for monthly payment or quarterly payment and that value is stored in User table Payment column name. In app when user wants to add a payment first he selects year after that according to the requirement the next dropdown is shown. If the Payment value is monthly then months dropdown if value is quarterly then Quarter dropdown.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac I also tired this: DB::table(users)->select('column_name')->distinct()->get(); but that also doesnt solve my problem.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac Exactly thats why I was checking it in View. So in controller I should include only one where clause?

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac I tired that code but its showing me both the dropdown.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac It is returning two records because there is one record with monthly and another with quarterly. I only need to check that if column has value MONTH then display month dropdown else quarter dropdown.

jeetdholakia left a reply on Display Data In View According To If Condition

@d3xt3r I want to select a particular column where values are monthly and quarterly and display dropdown according to it. If its monthly then months will be there else Quarters will be there.

jeetdholakia left a reply on Display Data In View According To If Condition

@tomo_pongrac I tried that but getting following error: "Undefined property: Illuminate\Database\Eloquent\Collection::$column_name"

jeetdholakia started a new conversation Display Data In View According To If Condition

Hello, I am fetching one column from database where values can be "monthly or quarterly". I am passing that to view and in view I am running if condition to check whether the value is "monthly" or "quarterly" but its not working. Controller:

$main= User::select('column_name')->get();

View:

@if($main == "monthly")
<option value="">Select Month*</option>
@elseif($main == "quarterly")
<option value="">Select Quarter*</option>
@endif

Thanks in advance.

18 Jun
3 years ago

jeetdholakia left a reply on Redisplay View On Dropdown Select Value

@Snapey ya I am returning formatted HTML data. Controller code:

$returnHTML =  view('admin.memberdetails',['memberdetails' => $memberdetails])->render();       
return response()->json(array('success' => true, 'html'=>$returnHTML));

Ajax code for success:

success: function(data) {
            console.log('success');
            console.log("Data=======================",data);
            
            if(data.success == true) {
              //user_jobs div defined on page
              result = [
              "@if (isset($memberdetails))"
              "@foreach($memberdetails as $md)",
              "<tr>"
              "<td>{{ $md->memberid }}</td>",
              "<td>{{ ucwords($md->user->societyname)}}</td>",
              "<td>{{ $md->wing }}</td>",
              "<td>{{ ucwords($md->membername) }}</td>",
              "<td>{{ $md->flatnumber }}</td>",
            "</tr>",
            "@endforeach",
            "@endif"
              ];
              $('.ajaxdata').html(result);
            }

Basically I want to display blade code inside ajax success.

jeetdholakia left a reply on Redisplay View On Dropdown Select Value

@tomo_pongrac It gives me internal server error 500

17 Jun
3 years ago

jeetdholakia left a reply on Redisplay View On Dropdown Select Value

@tomo_pongrac That error was solved. In ajax code for success I have following code:

if(data.success == true) {
$('.ajaxdata').html(data.html);
} else {
$('.ajaxdata').html(data.html + '{{ $sd->societyname }}'); //just to test
}

How to get actual table?

jeetdholakia left a reply on Redisplay View On Dropdown Select Value

@tomo_pongrac Below is my ajax code:

$(document).ready(function() {
    $('select#societyname').on('change', function() {
      var optionSelected = $(this).find("option:selected");
      societySelected  = optionSelected.val();
      console.log(societySelected);

      $.ajax({
        type: "POST",
        cache: false,
        url : "{{ route('postViewAllMembers') }}",
        datatype: 'JSON',
        data: { societyname : societySelected },
        success: function(data) {
            console.log('success');
            console.log(data);

Controller:

$societyname = Input::get('societyname');
$societyid = DB::table('users')->select('societyid')->where('societyname', '=', $societyname)->first();
$memberdetails = Member::where('socityid', '=', $societyid);
$returnHTML =  view('admin.memberdetails',['memberdetails' => $memberdetails])->render();
dd($returnHTML);
return response()->json(array('success' => true, 'html'=>$returnHTML)); 

View:

<table class="table no-margin text-center table-striped">
          <thead>
            <tr>
              <th>Member ID</th>
              <th>Society Name</th>
              <th>Wing</th>
              <th>Member Name</th>
              <th>Flat Number</th>
              <th>Mobile Number</th>
              <th>Email</th>
              <th>Flat Area</th>
            </tr>
          </thead>
          <tbody class="ajaxdata">
            @foreach($memberdetails as $md)
            <tr>
              <td>{{ $md->memberid }}</td>
              <td>{{ ucwords($md->user->societyname)}}</td>
              <td>{{ $md->wing }}</td>
              <td>{{ ucwords($md->membername) }}</td> <!-- ucwords to capitalize every first letter of word -->
              <td>{{ $md->flatnumber }}</td>
              <td>{{ $md->mobile }}</td>
              <td>{{ $md->email }}</td>
              <td>{{ $md->flatarea }}</td>
            </tr>
            @endforeach
          </tbody>
        </table>

But getting this error: http://prntscr.com/bhj8rn I tried many different things but this error is coming.

jeetdholakia left a reply on Redisplay View On Dropdown Select Value

@tomo_pongrac As of now I am using form action method to grab society name and then fetch data from database according to that id. But not able to display it in view.

jeetdholakia started a new conversation Redisplay View On Dropdown Select Value

Hello, I am generating dropdown from database which includes certain name of society. I want to know how to regenerate table according to the selected society. e.g. if someone selects society 1, members of that society should be displayed. Dropdown code to get society name:

<option value="">Select Society To View All Members*</option>
@foreach ($societydetails as $sd) 
 {
<option value="{{ $sd->societyname }}">{{ ucwords($sd->societyname) }}</option>
}
@endforeach

Table code to display data according to society:

<table class="table no-margin text-center table-striped">
          <thead>
            <tr>
              <th>Member ID</th>
              <th>Society Name</th>
              <th>Wing</th>
              <th>Member Name</th>
              <th>Flat Number</th>
            </tr>
          </thead>
          <tbody>
          @foreach($memberdetails as $md)
            <tr>
              <td>{{ $md->memberid }}</td>
              <td>{{ ucwords($md->user->societyname)}}</td>
              <td>{{ $md->wing }}</td>
              <td>{{ ucwords($md->membername) }}</td> 
              <td>{{ $md->flatnumber }}</td>
            </tr>
          @endforeach
          </tbody>
        </table>

Controller to display society name in dropdown:

public function memberdetails()
    {
        $societydetails = Society::all();
        return view('admin.memberdetails',['societydetails' => $societydetails]);
    }

Thanks in advance.

14 Jun
3 years ago

jeetdholakia left a reply on How Pass Value Of One Table Into Other Table Using Controller?

I have already written the code, its just the logic part I am not getting and that was my query.

jeetdholakia left a reply on How Pass Value Of One Table Into Other Table Using Controller?

@rch I am sorry if its very basic question and thank you for answering it :) will make sure next time to check properly.

jeetdholakia left a reply on How Pass Value Of One Table Into Other Table Using Controller?

I am not saying to write a code for me. I just need idea to move ahead. I know its a learning forum and Its helping me a lot to learn. I appreciate your help but I am confused and thats why I posted here.

jeetdholakia left a reply on How Pass Value Of One Table Into Other Table Using Controller?

@pmall I know the docs but not getting exact ans thats why I posted here.

jeetdholakia started a new conversation How Pass Value Of One Table Into Other Table Using Controller?

Hello, I am working on a app where I am selecting a name of person from dropdown which comes from a table User. Now I am creating other details for that particular user in other table named Member Details. So what I want is to insert that new details into member details table along with the id of selected user from the user table. Thanks in advance.

06 Jun
3 years ago

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@kingpabel I have done that only, The thing I wanted is to get the data inside the modal according to ID.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac Yes, I checked it for all. Thank you once again.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac FINALLY :) Yeah I tried it with get() method but not with first. Once again thank you so so much for helping me :)

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac societyid is there in the database. See this: http://prntscr.com/bd00ec Same error for societyname also.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac I am doing that only but that undefined property error is coming. Code in modal body:

<table class="table table-striped">
  <tr>
    <td>Society ID</td>
    <td>{{ $sd->societyid }}</td>
  </tr>
  <tr>
    <td>Society Name</td>
    <td>{{ $sd->societyname }}</td>
  </tr>
</table>

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac But in controller I am passing ['sd' => $sd] even if i change it to $sc in controller and everywhere getting the same error.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac No help :( If I open the link manually then this error is coming: http://prntscr.com/bczrb7

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac Its coming when the modal is getting opened not by manually opening the link. Same thing is coming if i manually opening this link.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac I modified the code in controller to this:

$sd = DB::table('user')->where('societyid', '=', $societyid);
return view('admin.modalview', ['sd' => $sd]);  

If I use {{ $sd->societyname }} to output data in modalview I am getting error and if I am only using normal data such as HTML code then output is coming.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac It works. Getting "Works" in modal body.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac I changed the controller code according to the above mentioned code by you, still the modal shows no data and I am getting following internal server error: http://prntscr.com/bcyzxf modalview.blade.php:

<table class="table table-striped">
  <tr>
    <td>Society ID</td>
    <td></td>
  </tr>
  <tr>
    <td>Society Name</td>
    <td></td>
  </tr>
</table>    

PS: I am sorry for asking this much and thanks a lot for helping me.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac If I open localhost:8000/admin/society/KPCP it gives me blank page with nothing on it. The routes and controller are exact same like you have mentioned.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac Ya its a valid society id. in data-target-id="{{ $sd->societyid }}" I am getting value from database.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac Here is the code for controller:

public function viewmodal($societyid)
    {
        $view = View::make('admin.modalview', ['societyid'=> $societyid]);
        $contents = $view->render();
    }   

and here is the error in console: http://prntscr.com/bcymjz

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

I tried your code also and mine also. Both give me 500 internal server error in console.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac Ok I added the link manually but still the modal body is empty.

<script>
    $(document).ready(function(){
      var base_url = window.location.origin;
      $("#societydetails").on("show.bs.modal", function(e) {
        var id = $(e.relatedTarget).data('target-id');
        $.get(base_url + '/admin' + '/society/' + id, function( data ) {
          $(".modal-body").html(data);
        });

      });
    });
  </script>

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac This is proper?

$.get( {{ route('viewmodal',$sd->societyid) }}, function( data )

Because in modal nothing is coming.

jeetdholakia left a reply on How To Get Dynamic Data In Bootstrap Modal?

@tomo_pongrac That worked but can u tell me what to write in

$.get( "/controller/" + id, function( data ) 

This "/controller/" url?