Member Since 1 Year Ago
4,230 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
Replied to How To Display A Value In The First Column Of A Generated Table?
I already used your recommended method in the code I sent. It is not the solution.
Started a new Conversation How To Display A Value In The First Column Of A Generated Table?
This is the table => https://imgur.com/a/E4dwRmY
When I apply the code below it displays same score across the parts. What I want is for it to display score from the database only under the first part(i.e Part1). The other parts will be manually inputted. The Parts (the columns) are dynamically generated which means they can be 3, 4 or 5 parts but I only want to automatically display the score for the first part. The ids of the column parts are dynamic as well since they are generated.
<thead>
<tr>
<th colspan="{{$parts_numbers + 1}}"></th>
</tr>
<tr>
@foreach($part_form as $part)
<th>{{$part->title}}</th>
@endforeach
</tr>
</thead>
<tbody>
@php $colspan = 3; $counter = 0; @endphp
@foreach($students as $student)
@foreach($part_form as $part)
<td>
<div>
<input type="hidden" name="score_setup_ids[]" value="{{$part->id}}">
<?php
$part_score = App\MyScores::where([['class_id', $part->class_id], ['subject_id', $part->subject_id], ['exam_id', $exam->id], ['student_id', $student->id]])->first();
?>
<input class="primary-input marks_input" type="number" step="any" name="marks[{{$student->id}}][{{$part->id}}]" value="{{!empty($part_score->mark)?$part_score->mark:0}}">
</div>
</td>
@endforeach
@endforeach
Replied to How To Update An Existing Array Of Items
Great! @marianomoreyra It worked. Perfecto! Can you please explain the logic behind your solution?
Replied to How To Update An Existing Array Of Items
Thank you @marianomoreyra . I tried your solution but it gave this error
Illuminate \ Database \ QueryException
Array to string conversion (SQL: update `questionanswer`
Started a new Conversation How To Update An Existing Array Of Items
I am trying to add marks to questions answered by a specific student. It is an array of existing questions and answers and i want to add marks to them.
When i add the marks and save , i get this error "BadMethodCallException Method Illuminate\Database\Eloquent\Collection::save does not exist."
This is my view
<?php $i = 1; ?>
@foreach($questions as $question)
@if ($i > 1) @endif
<tr>
<td width="60%">
<ul class="list-group">
<li class="list-group-item"><label class="control-label"><strong>Question {{ $i }}<br />{{$question->question}}</strong></label>
<div class="col-sm-12">
<input type="hidden" name="questions[{{ $i }}]" value="{{ $question->id }}"><br>
<div class="input-effect">
<textarea class="primary-input form-control{{ $errors->has('result') ? ' is-invalid' : '' }}" cols="0" rows="5" name="result[{{ $question->id }}]">{{$question->result}}</textarea>
</div>
<?php $i++; ?>
</div>
</td>
<td width="20%" class="text-right">
<div class="mt-20">
<input type="number" name="mark[{{ $question->id }}]" value="{{$question->mark}}">
</div>
<div>
<textarea class="primary-input form-control{{ $errors->has('reason') ? ' is-invalid' : '' }}" cols="0" rows="3" name="reason[{{ $question->id }}]"></textarea>
</div>
</td>
</tr>
@endforeach
This is controller to store the marks
public function MarkStore(Request $request)
{
$questions = QuestionAnswer::where('quiz', 1)->where('user', 1)
->get();
$questions->mark = $request->input('mark');
$questions->reason = $request->input('reason');
$questions->save();
}
How do i store the marks without errors?
Started a new Conversation How To Get Minimum Value Without Zero?
With this function, i get the lowest number but strangely it captured 0 as the lowest number in some cases. How do i make it ignore 0?
``` public static function MinNumber($group_id, $segment_id){
try {
$post = Position::where([
['group_id',$group_id],
['segment_id',$segment_id]
])->orderBy('position_number', 'ASC')->first();
return $post;
} catch (\Exception $e) {
$post=[];
return $post;
}
} ```
Replied to How To Sum Carbon Converted Dates?
It worked.. Final solution provided by @silencebringer and one time solution by @michaloravec both worked.. Many thanks.
Replied to How To Sum Carbon Converted Dates?
Thank you @michaloravec . So close but it only gave the age of the last member and not the sum of all the member's ages.
Replied to How To Sum Carbon Converted Dates?
"This could have worked but rather than give a sum of all members age , it only results to the age of the last member. In other words, just one member's age is displayed."
Replied to How To Sum Carbon Converted Dates?
I have the adjusted code but its not working.
``` $membersage = Member::where('members.id', '=', $request->member)
->where('active_status', 1)
->sum(function ($member) {
return \Carbon\Carbon::parse($member->date_of_birth)->age;
}); ```
No errors but just blank
Replied to How To Sum Carbon Converted Dates?
Thank you @silencebringer . Your solution did not work .
It gave this error :
``` ParseError
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')' ```
Started a new Conversation How To Sum Carbon Converted Dates?
I can convert date of births in db to AGE using carbon like so \Carbon\Carbon::parse('members.date_of_birth')->age
but how do i sum AGE from date of births. This is my controller
``` $membersage = Member::where('members.id', '=', $request->member)
->where('active_status', 1)
->sum(\Carbon\Carbon::parse('members.date_of_birth')->age); ```
This did not work.