nogepog

nogepog

Member Since 1 Month Ago

Experience Points 680
Experience Level 1

4,320 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 0
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.

20 May
2 days ago

nogepog started a new conversation Modify Ajax Script To Perform Update/create On The Same Route

I am a beginner and was reading docs today, Icame across the updateorcreate method in documentations .i have a ajax script to perform save operation how do i modify it to operate as both save and edit.

$('#save_score').click(function(){

     team = $('#team').val();
     score= $('#score').val();
     fouls= $('#fouls').val();

     $.ajax({
         type:'post',
         url:'/save_score',
         data:{team:team,score:score,fouls:fouls},
         success:function(data){
             console.log(data);
             $('#myModal').modal('hide');
         }

});

public function save_score(Request $request){ $team = $requst->team; $score = $request->score; $fouls = $request->fouls;

    $v = new Score();
    $v->team= $team;
    $v->fouls= $fouls;
    $v->score= $score;
    $v->save();

    $notification = array(
        'message' => 'Your response has been saved successfully.', 
        'alert-type' => 'success'
    );
    return redirect()->back()->with($notification);

}

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">New Score</h4>
      </div>
      <div class="modal-body">
        
        <br><br>
            <select class="form-control" id="team">
            <option value="">select visit</option>
            @foreach($teams as $team)
            <option value="{{$team->id}}">{{$visit->name}}</option>
            @endforeach
            </select>
            <br><br>
            <input type="number" id="score" placeholder="score" class="form-control"/>
            <br>
            <br>
            <input type="number" id="fouls" placeholder="fouls" class="form-control"/>
                
        <br><br>
        <button class="btn btn-danger" id="save_score">Save </button>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

Route::post('/save_score','[email protected]_score');

14 May
1 week ago

nogepog started a new conversation Allow Users To Change Their Password From Edit Form

I have a edit users form with all the fields user filled in registration form.How do i allow the user to modify their password and confirm password on edit. I have this way,which prints the old password.How do i unhash it and then hash it upon submit.When i try to submit the form without changing the old password the password is changed.

Password *

{{ $errors->first('password',$user->password) }}
User::whereId($id)->update(['password' => bcrypt($request->password)]);
10 May
1 week ago

nogepog started a new conversation Crud Generators With Support Of Laravel 5.8 And Nested Relationships

I am looking for crud generators(free) for my laravel app admin panel.I have a custom admin panel and would like to add crud parts to it. crud for a relation like user->albums->pictures->comments as one to many chained.Ajax and excel export will be a plus.

nogepog started a new conversation Validate UpdateOrCreate Method

I wanted to use updateorcreate method in replacement for edit method.How do i add validation to updateOrCreate method with the following code

User::updateOrCreate(['id' => $request->product_id],

            ['name' => $request->name, 'email' => $request->email]);        



    return response()->json(['success'=>'User saved successfully.']);
03 May
2 weeks ago

nogepog started a new conversation Pass Current Id And Date From Table Submit Button

I am trying to pass userid and date of the row where the submit button is selected.But when i press submit on one of the rows the data being passed is of all the rows present.How do i send selected row to the controller's store method

User name Email y Start Date @forelse ($users as $user) @if($user->type == 'student') {{ $user->name }} {{ $user->email }}
                                         <button class="submit" >Submit</button>
                                </td>
                           
                            </tr>
                         @endif
                        @empty
                            <tr>
                                <td colspan="4">No users found.</td>
                            </tr>
                        @endforelse
02 May
2 weeks ago

nogepog started a new conversation Saving Request From Store Method In Two Tables Based On Condition.

I have a form with 200 fields.Each field has a column in database with the type of field.A field can be of type T/F,number or text. I want to save each field type in a separate table in database based on their type. e.g 44)do you smoke? t/f should be saved in true_false_response table 66)How many boxes per week? number should be saved in numeric_response table.

How do i filter these fields out and save them in three different tables.with a possibility that some fields also may be empty.

30 Apr
3 weeks ago

nogepog left a reply on Show Values From Jsondecode In Blade

@MICHALURVA - I get this message

ErrorException (E_ERROR) Invalid argument supplied for foreach() (View: C:\Users\UNKNOWN DEVICE\Projects\project files\nutrition\resources\views\layouts\suggestion\index.blade.php) Previous exceptions Invalid argument supplied for foreach() (0)

nogepog started a new conversation Show Values From Jsondecode In Blade

I am saving the values from if statements into array using array push.After that encoding that using json encode to save to the database in a json field

if ((int) $request->get('747') <150){ array_push($suggestions,'You have completed 40 hours of training'); } }

$myJSON = json_encode($suggestions,true);
$notification= new Suggestion([
    
 
    'response' => $myJSON,
    'category'=> "1",
    ]);
  $notification->save();
  return redirect('/home');



}

when i try to access the field in my blade file it shows as a single array ["some text some text some text", "some text some text some text", "some text some text some text", ]

how do i show this as a unordered list.

29 Apr
3 weeks ago

nogepog left a reply on Multiple Models With Chained One-many Relationships

@NEEONLINE - Thanks. Another question, is there an alternative to this convention image/{image} for chaining multiple routes?rather than showing them in the address bar

27 Apr
3 weeks ago

nogepog started a new conversation Multiple Models With Chained One-many Relationships

i have 4 models with one-many relationships

user hasmany-> pages page hasmany-> images image hasmany-> comments

how do i create relationship and chain them so that

www.postme.com/user/1/page/2/image/44/comment/1

and how do i save the comment which will require user,page and image foreign keys

nogepog left a reply on Union A Collection With Missing Values

@DEVFREY - Thanks for the reply.I tried this method,it adds the missing ones but some of them are now in a nested array.

I want to flatten the array as one ['item_id','amount','item_id','amount' , ... ,'item_id','amount', ] and i cannot do that for item 10,11,12

0 => {#428 ▶} 1 => {#422 ▶} 2 => {#421 ▶} 3 => {#427 ▶} 4 => {#425 ▶} 7 => array:2 [▶] 8 => array:2 [▶] 9 => array:2 [▶] 10 => array:2 [▶] 11 => array:2 [▶] 5 => {#426 ▶} 12 => array:2 [▶] 6 => {#424 ▶}

26 Apr
3 weeks ago

nogepog left a reply on Union A Collection With Missing Values

@PIXELKODE - Thanks for the reply.What if the id 2,5 already exists in the collection will it be replaced??i don't want to replace existing items.

nogepog started a new conversation Union A Collection With Missing Values

Hi, i am trying to add missing values to a collection that results my database table containing multiple items.

What i am trying to attempt is to add the items that are missing from collection as union values.

Collection {#217 ▼

#items: array:7 [▼

0 => {#397 ▼

  +"item_id": 1

  +"amount": "4"

}

1 => {#402 ▼

  +"item_id": 3

  +"amount": "1"

}

2 => {#396 ▶}

3 => {#213 ▶}

4 => {#399 ▶}

5 => {#400 ▶}

6 => {#398 ▶}

]

}

what i want here is to add another entry between id 1 and 3 which will be

1 => {# ▼

  +"item_id": 2

  +"amount": "0"

}

i used union but it's not working,it makes a spererate array $union = $collection->union([2 => ['0']]);

23 Apr
4 weeks ago

nogepog left a reply on How To Access Json Values To Check Conditionals

@JLRDW - Pluck will not work in my problem.I have converted it to collection and got the collection which car_id 1.How do i then get the pieces of that specific car?(the reason i am using contains() because i am creating if statements for all car id's 1-20 which may or may not be present in the collection if deleted or transferred) $collection = collect($cars);

    if($collection->contains('car_id', 1)){
        echo 'Tesla';
    }

nogepog left a reply on How To Access Json Values To Check Conditionals

@PATRICKADVANCE - Thanks for the reply.I want to do this on my controller and then save the responses in a table.Do i need another if statement to evaluate the pieces variable?? i want to check conditions on pieces not on the car_id. e.g send a messages if a specific car(car_id tesla) has less than 3 pieces

nogepog left a reply on How To Access Json Values To Check Conditionals

@JLRDW - i want to set the messages and then save them in a database table.

22 Apr
1 month ago

nogepog started a new conversation How To Access Json Values To Check Conditionals

I have converted a model to JSON which returns the following

[{"car_id":1,"pieces":"6"}, {"car_id":2,"pieces":"1"}, {"car_id":3,"pieces":"7"}, {"car_id":4,"pieces":"3"}, {"car_id":5,"pieces":"3"}]

how do i access the carid and pieces as seperate variables to run multiple if criteria

e.g if car_id 4 has pieces less than 3 print "this" ,equal to 3 print "this"

nogepog left a reply on Groupby Table Values In Eloquent

e.g

1 | 1 | 3

1 | 4 | 5

2 | 4 | 1

2 | 1 | 2

nogepog started a new conversation Groupby Table Values In Eloquent

I have three rows day_id|stationary_id|amount fk fk number how do i query eloquent to group by columns and find on which day which stationary was issued and in what amount

e.g 1 | 1 | 3 1 | 4 | 5 2 | 4 | 1 2 | 1 | 2

how do i determine If a stationary item is issued 2 or more days

20 Apr
1 month ago

nogepog left a reply on Display 4 Layers Of One To Many Relationships In A Single View

@TRAY2 - if i do this way and try to label each subsection with the title of that subsection saved in the table, the subsection will then keeps repeating per row how do i keep it from appearing in each row and show once ?

nogepog started a new conversation Display 4 Layers Of One To Many Relationships In A Single View

I am trying to generate 4 different dynamic forms from database.The form has many types , each type has many subsections,each sub-section (may/may not have) many sub-subsection, each sub-sub-subsection (may/may not have) many sub-sub-sub-section.

For this i have created each table with foreign-key relationship for the successor And all the pk's of these tables as fk references in the form table.

form id|type|subsection_id|sub-sub-section_id|sub-sub-sub-subsection_id|question

how do i display all forms in a list.So that when a user presses form 1 the fields associated open in next page.