Skip to content

Commit

Permalink
Daffa Haidar - Filtering Student Data Stage 3
Browse files Browse the repository at this point in the history
  • Loading branch information
daffahaidar committed Aug 19, 2022
1 parent 3101b77 commit 687e941
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
| **16 August 2022** | Completed Student Registration Form |
| **17 August 2022** | Filtering Student Data Stage 1 |
| **18 August 2022** | Filtering Student Data Stage 2 |
| **19 August 2022** | Filtering Student Data Stage 3 |
| **Next...** | coming soon... |

## Installation
Expand Down
15 changes: 14 additions & 1 deletion app/Models/AssignStudent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,18 @@

class AssignStudent extends Model
{
use HasFactory;
public function student()
{
return $this->belongsTo(User::class, 'student_id', 'id');
}

public function student_class()
{
return $this->belongsTo(StudentClass::class, 'class_id', 'id');
}

public function student_year()
{
return $this->belongsTo(StudentYear::class, 'year_id', 'id');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function up()
Schema::create('assign_students', function (Blueprint $table) {
$table->id();
$table->integer('student_id')->comment('user_id=student_id');
$table->integer('roll')->nullable();
$table->integer('class_id');
$table->integer('year_id');
$table->integer('group_id')->nullable();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
<option value="" selected="" disabled="">Pilih Tahun
</option>
@foreach ($years as $year)
<option value="{{ $year->id }}">{{ $year->name }}</option>
<option value="{{ $year->id }}"
{{ @$year_id == $year_id ? 'selected' : '' }}>
{{ $year->name }}</option>
@endforeach
</select>
</div>
Expand All @@ -41,7 +43,9 @@
<option value="" selected="" disabled="">Pilih Kelas
</option>
@foreach ($classes as $class)
<option value="{{ $class->id }}">{{ $class->name }}</option>
<option value="{{ $class->id }}"
{{ @$class_id == $class_id ? 'selected' : '' }}>
{{ $class->name }}</option>
@endforeach
</select>
</div>
Expand Down Expand Up @@ -72,7 +76,14 @@ class="btn btn-rounded btn-success mb-5"> Tambahkan Siswa</a>
<tr>
<th width="5%">No.</th>
<th>Nama</th>
<th>Nomor ID</th>
<th>NIS</th>
<th>Roll</th>
<th>Tahun</th>
<th>Kelas</th>
<th>Foto</th>
@if (Auth::user()->role == 'Admin')
<th>Kode</th>
@endif
<th width="25%">Tindakan</th>

</tr>
Expand All @@ -81,7 +92,14 @@ class="btn btn-rounded btn-success mb-5"> Tambahkan Siswa</a>
@foreach ($allData as $key => $value)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $value->class_id }}</td>
<td>{{ $value['student']['name'] }}</td>
<td>{{ $value['student']['id_no'] }}</td>
<td>{{ $value->roll }}</td>
<td>{{ $value['student_year']['name'] }}</td>
<td>{{ $value['student_class']['name'] }}</td>
<td><img src="{{ !empty($value['student']['image']) ? url('upload/student_images/' . $value['student']['image']) : url('upload/no_image.jpg') }}"
style="width: 60px; height: 80px; border: 2px solid #7A15F7; border-radius: 5px;">
</td>
<td>{{ $value->year_id }}</td>
<td>
<a href="" class="btn btn-info">Ubah</a>
Expand Down

0 comments on commit 687e941

Please sign in to comment.