created lesson table model etc
Cette révision appartient à :
Parent
a95f453cb4
révision
6b2f16b096
@ -38,7 +38,7 @@ public function store(AddNewRequest $request)
|
||||
try {
|
||||
$material = new Material;
|
||||
$material->title = $request->materialTitle;
|
||||
$material->course_id = $request->courseId;
|
||||
$material->lesson_id = $request->lessonId;
|
||||
$material->type = $request->materialType;
|
||||
$material->content = $request->content;
|
||||
$material->content_url = $request->contentURL;
|
||||
@ -88,7 +88,7 @@ public function update(UpdateRequest $request, $id)
|
||||
try {
|
||||
$material = Material::findOrFail(encryptor('decrypt', $id));
|
||||
$material->title = $request->materialTitle;
|
||||
$material->course_id = $request->courseId;
|
||||
$material->lesson_id = $request->lessonId;
|
||||
$material->type = $request->materialType;
|
||||
$material->content_url = $request->contentURL;
|
||||
|
||||
|
||||
113
app/Http/Controllers/LessonController.php
Fichier normal
113
app/Http/Controllers/LessonController.php
Fichier normal
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Lesson;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LessonController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$lesson = Lesson::paginate(10);
|
||||
return view('backend.course.lesson.index', compact('lesson'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$course = Course::get();
|
||||
return view('backend.course.lesson.create', compact('course'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$lesson = new Lesson;
|
||||
$lesson->title = $request->lessonTitle;
|
||||
$lesson->course_id = $request->courseId;
|
||||
|
||||
if ($lesson->save()) {
|
||||
$this->notice::success('Data Saved');
|
||||
return redirect()->route('lesson.index');
|
||||
} else {
|
||||
$this->notice::error('Please try again');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// dd($e);
|
||||
$this->notice::error('Please try again');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Lesson $lesson)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Lesson $lesson)
|
||||
{
|
||||
$course = Course::get();
|
||||
$lesson = Lesson::findOrFail(encryptor('decrypt', $id));
|
||||
return view('backend.course.lesson.edit', compact('course', 'lesson'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Lesson $lesson)
|
||||
{
|
||||
try {
|
||||
$lesson = Lesson::findOrFail(encryptor('decrypt', $id));
|
||||
$lesson->title = $request->lessonTitle;
|
||||
$lesson->lesson_id = $request->lessonId;
|
||||
$lesson->type = $request->materialType;
|
||||
$lesson->content_url = $request->contentURL;
|
||||
|
||||
if ($request->hasFile('content')) {
|
||||
$contentName = rand(111, 999) . time() . '.' . $request->content->extension();
|
||||
$request->content->move(public_path('uploads/courses/contents'), $contentName);
|
||||
$lesson->content = $contentName;
|
||||
}
|
||||
if ($lesson->save()) {
|
||||
$this->notice::success('Data Saved');
|
||||
return redirect()->route('lesson.index');
|
||||
} else {
|
||||
$this->notice::error('Please try again');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// dd($e);
|
||||
$this->notice::error('Please try again');
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Lesson $lesson)
|
||||
{
|
||||
$data = Lesson::findOrFail(encryptor('decrypt', $id));
|
||||
if ($data->delete()) {
|
||||
$this->notice::error('Data Deleted!');
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
app/Models/Lesson.php
Fichier normal
11
app/Models/Lesson.php
Fichier normal
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Lesson extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
32
database/migrations/2023_11_26_153557_create_lessons_table.php
Fichier normal
32
database/migrations/2023_11_26_153557_create_lessons_table.php
Fichier normal
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('lessons', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title', 255)->nullable(false);
|
||||
$table->unsignedBigInteger('course_id')->index();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('lessons');
|
||||
}
|
||||
};
|
||||
@ -13,7 +13,7 @@ public function up(): void
|
||||
{
|
||||
Schema::create('materials', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('course_id')->index();
|
||||
$table->unsignedBigInteger('lesson_id')->index();
|
||||
$table->string('title', 255)->nullable(false);
|
||||
$table->enum('type', ['video', 'document', 'quiz'])->nullable(false);
|
||||
$table->string('content')->nullable();
|
||||
@ -21,7 +21,7 @@ public function up(): void
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
|
||||
$table->foreign('lesson_id')->references('id')->on('lessons')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
123
resources/views/backend/course/lesson/create.blade.php
Fichier normal
123
resources/views/backend/course/lesson/create.blade.php
Fichier normal
@ -0,0 +1,123 @@
|
||||
@extends('backend.layouts.app')
|
||||
@section('title', 'Add Course Material')
|
||||
|
||||
@push('styles')
|
||||
<!-- Pick date -->
|
||||
<link rel="stylesheet" href="{{asset('public/vendor/pickadate/themes/default.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('public/vendor/pickadate/themes/default.date.css')}}">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="content-body">
|
||||
<!-- row -->
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row page-titles mx-0">
|
||||
<div class="col-sm-6 p-md-0">
|
||||
<div class="welcome-text">
|
||||
<h4>Add Course Material</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{route('dashboard')}}">Home</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{route('material.index')}}">Course Materials</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{route('material.create')}}">Add Course Material</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-xxl-12 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Basic Info</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{route('material.store')}}" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Title</label>
|
||||
<input type="text" class="form-control" name="materialTitle"
|
||||
value="{{old('materialTitle')}}">
|
||||
</div>
|
||||
@if($errors->has('materialTitle'))
|
||||
<span class="text-danger"> {{ $errors->first('materialTitle') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Course</label>
|
||||
<select class="form-control" name="courseId">
|
||||
@forelse ($course as $c)
|
||||
<option value="{{$c->id}}" {{old('courseId')==$c->id?'selected':''}}>
|
||||
{{$c->title_en}}</option>
|
||||
@empty
|
||||
<option value="">No Course Found</option>
|
||||
@endforelse
|
||||
</select>
|
||||
</div>
|
||||
@if($errors->has('courseId'))
|
||||
<span class="text-danger"> {{ $errors->first('courseId') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Material Type</label>
|
||||
<select class="form-control" name="materialType">
|
||||
<option value="video" @if(old('materialType')=='video' ) selected @endif>
|
||||
Video
|
||||
</option>
|
||||
<option value="document" @if(old('materialType')=='document' ) selected
|
||||
@endif>Document
|
||||
</option>
|
||||
<option value="quiz" @if(old('materialType')=='quiz' ) selected @endif>Quiz
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Content</label>
|
||||
<input type="file" class="form-control" name="content">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Content Url</label>
|
||||
<textarea class="form-control"
|
||||
name="contentURL">{{old('contentURL')}}</textarea>
|
||||
</div>
|
||||
@if($errors->has('contentURL'))
|
||||
<span class="text-danger"> {{ $errors->first('contentURL') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<button type="submit" class="btn btn-light">Cencel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- pickdate -->
|
||||
<script src="{{asset('public/vendor/pickadate/picker.js')}}"></script>
|
||||
<script src="{{asset('public/vendor/pickadate/picker.time.js')}}"></script>
|
||||
<script src="{{asset('public/vendor/pickadate/picker.date.js')}}"></script>
|
||||
|
||||
<!-- Pickdate -->
|
||||
<script src="{{asset('public/js/plugins-init/pickadate-init.js')}}"></script>
|
||||
@endpush
|
||||
130
resources/views/backend/course/lesson/edit.blade.php
Fichier normal
130
resources/views/backend/course/lesson/edit.blade.php
Fichier normal
@ -0,0 +1,130 @@
|
||||
@extends('backend.layouts.app')
|
||||
@section('title', 'Edit Course Material Material')
|
||||
|
||||
@push('styles')
|
||||
<!-- Pick date -->
|
||||
<link rel="stylesheet" href="{{asset('public/vendor/pickadate/themes/default.css')}}">
|
||||
<link rel="stylesheet" href="{{asset('public/vendor/pickadate/themes/default.date.css')}}">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="content-body">
|
||||
<!-- row -->
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row page-titles mx-0">
|
||||
<div class="col-sm-6 p-md-0">
|
||||
<div class="welcome-text">
|
||||
<h4>Edit Course Material</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{route('dashboard')}}">Home</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{route('material.index')}}">Course Materials</a></li>
|
||||
<li class="breadcrumb-item active"><a href="javascript:void(0);">Edit Course Material</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12 col-xxl-12 col-sm-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Basic Info</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{route('material.update',encryptor('encrypt', $material->id))}}" method="post"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<input type="hidden" name="uptoken" value="{{encryptor('encrypt',$material->id)}}">
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Title</label>
|
||||
<input type="text" class="form-control" name="materialTitle"
|
||||
value="{{old('materialTitle',$material->title)}}">
|
||||
</div>
|
||||
@if($errors->has('materialTitle'))
|
||||
<span class="text-danger"> {{ $errors->first('materialTitle') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Course</label>
|
||||
<select class="form-control" name="courseId">
|
||||
@forelse ($course as $c)
|
||||
<option value="{{$c->id}}" {{old('courseId', $material->course_id) ==
|
||||
$c->id?'selected':''}}>
|
||||
{{$c->title_en}}</option>
|
||||
@empty
|
||||
<option value="">No Course Material Material Found</option>
|
||||
@endforelse
|
||||
</select>
|
||||
</div>
|
||||
@if($errors->has('courseId'))
|
||||
<span class="text-danger"> {{ $errors->first('courseId') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Material Type</label>
|
||||
<select class="form-control" name="materialType">
|
||||
<option value="video" @if(old('materialType', $material->type)=='video' ) selected
|
||||
@endif>Video
|
||||
</option>
|
||||
<option value="document" @if(old('materialType', $material->type)=='document' ) selected
|
||||
@endif>Document
|
||||
</option>
|
||||
<option value="quiz" @if(old('materialType', $material->type)
|
||||
=='quiz' )
|
||||
selected @endif>Quiz</option>
|
||||
</select>
|
||||
</div>
|
||||
@if($errors->has('materialType'))
|
||||
<span class="text-danger"> {{ $errors->first('materialType') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Content</label>
|
||||
<input type="file" class="form-control" name="content">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Content Url</label>
|
||||
<textarea class="form-control"
|
||||
name="contentURL">{{old('contentURL',$material->content_url)}}</textarea>
|
||||
</div>
|
||||
@if($errors->has('contentURL'))
|
||||
<span class="text-danger"> {{ $errors->first('contentURL') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<button type="submit" class="btn btn-light">Cencel</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- pickdate -->
|
||||
<script src="{{asset('public/vendor/pickadate/picker.js')}}"></script>
|
||||
<script src="{{asset('public/vendor/pickadate/picker.time.js')}}"></script>
|
||||
<script src="{{asset('public/vendor/pickadate/picker.date.js')}}"></script>
|
||||
|
||||
<!-- Pickdate -->
|
||||
<script src="{{asset('public/js/plugins-init/pickadate-init.js')}}"></script>
|
||||
@endpush
|
||||
119
resources/views/backend/course/lesson/index.blade.php
Fichier normal
119
resources/views/backend/course/lesson/index.blade.php
Fichier normal
@ -0,0 +1,119 @@
|
||||
@extends('backend.layouts.app')
|
||||
@section('title', 'Course Material List')
|
||||
|
||||
@push('styles')
|
||||
<!-- Datatable -->
|
||||
<link href="{{asset('public/vendor/datatables/css/jquery.dataTables.min.css')}}" rel="stylesheet">
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="content-body">
|
||||
<!-- row -->
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row page-titles mx-0">
|
||||
<div class="col-sm-6 p-md-0">
|
||||
<div class="welcome-text">
|
||||
<h4>Course Material List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{route('dashboard')}}">Home</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{route('material.index')}}">Course Materials</a></li>
|
||||
<li class="breadcrumb-item active"><a href="{{route('material.index')}}">All Course Material</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ul class="nav nav-pills mb-3">
|
||||
<li class="nav-item"><a href="#list-view" data-toggle="tab"
|
||||
class="nav-link btn-primary mr-1 show active">List View</a></li>
|
||||
<li class="nav-item"><a href="javascript:void(0);" data-toggle="tab"
|
||||
class="nav-link btn-primary">Grid
|
||||
View</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="row tab-content">
|
||||
<div id="list-view" class="tab-pane fade active show col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">All Course Materials List </h4>
|
||||
<a href="{{route('material.create')}}" class="btn btn-primary">+ Add new</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="example3" class="display" style="min-width: 845px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{__('#')}}</th>
|
||||
<th>{{__('Title')}}</th>
|
||||
<th>{{__('Course')}}</th>
|
||||
<th>{{__('Material Type')}}</th>
|
||||
<th>{{__('Content')}}</th>
|
||||
<th>{{__('Content Url')}}</th>
|
||||
<th>{{__('Action')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($material as $m)
|
||||
<tr>
|
||||
<td>{{$m->id}}</td>
|
||||
<td>{{$m->title}}</td>
|
||||
<td>{{$m->course?->title_en}}</td>
|
||||
<td>
|
||||
{{ $m->type == 'video' ? __('Video') : ($m->type == 'document' ?
|
||||
__('Document') : __('Quiz')) }}
|
||||
</td>
|
||||
<td>
|
||||
<embed
|
||||
src="{{asset('public/uploads/courses/contents/'.$m->content)}}"
|
||||
width="100px" height="50px" />
|
||||
</td>
|
||||
<td>{{$m->content_url}}</td>
|
||||
<td>
|
||||
<a href="{{route('material.edit', encryptor('encrypt',$m->id))}}"
|
||||
class="btn btn-sm btn-primary" title="Edit"><i
|
||||
class="la la-pencil"></i></a>
|
||||
<a href="javascript:void(0);" class="btn btn-sm btn-danger"
|
||||
title="Delete" onclick="$('#form{{$m->id}}').submit()"><i
|
||||
class="la la-trash-o"></i></a>
|
||||
<form id="form{{$m->id}}"
|
||||
action="{{route('material.destroy', encryptor('encrypt',$m->id))}}"
|
||||
method="post">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<th colspan="6" class="text-center">No Course Material Found</th>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Datatable -->
|
||||
<script src="{{asset('public/vendor/datatables/js/jquery.dataTables.min.js')}}"></script>
|
||||
<script src="{{asset('public/js/plugins-init/datatables.init.js')}}"></script>
|
||||
|
||||
@endpush
|
||||
@ -52,17 +52,17 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Course</label>
|
||||
<select class="form-control" name="courseId">
|
||||
@forelse ($course as $c)
|
||||
<option value="{{$c->id}}" {{old('courseId')==$c->id?'selected':''}}>
|
||||
{{$c->title_en}}</option>
|
||||
<select class="form-control" name="lessonId">
|
||||
@forelse ($lesson as $l)
|
||||
<option value="{{$l->id}}" {{old('lessonId')==$l->id?'selected':''}}>
|
||||
{{$l->title}}</option>
|
||||
@empty
|
||||
<option value="">No Course Found</option>
|
||||
@endforelse
|
||||
</select>
|
||||
</div>
|
||||
@if($errors->has('courseId'))
|
||||
<span class="text-danger"> {{ $errors->first('courseId') }}</span>
|
||||
@if($errors->has('lessonId'))
|
||||
<span class="text-danger"> {{ $errors->first('lessonId') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
|
||||
@ -54,18 +54,18 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Course</label>
|
||||
<select class="form-control" name="courseId">
|
||||
@forelse ($course as $c)
|
||||
<option value="{{$c->id}}" {{old('courseId', $material->course_id) ==
|
||||
$c->id?'selected':''}}>
|
||||
{{$c->title_en}}</option>
|
||||
<select class="form-control" name="lessonId">
|
||||
@forelse ($lesson as $l)
|
||||
<option value="{{$l->id}}" {{old('lessonId', $material->lesson_id) ==
|
||||
$l->id?'selected':''}}>
|
||||
{{$l->title}}</option>
|
||||
@empty
|
||||
<option value="">No Course Material Material Found</option>
|
||||
@endforelse
|
||||
</select>
|
||||
</div>
|
||||
@if($errors->has('courseId'))
|
||||
<span class="text-danger"> {{ $errors->first('courseId') }}</span>
|
||||
@if($errors->has('lessonId'))
|
||||
<span class="text-danger"> {{ $errors->first('lessonId') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
|
||||
@ -53,7 +53,7 @@ class="nav-link btn-primary">Grid
|
||||
<tr>
|
||||
<th>{{__('#')}}</th>
|
||||
<th>{{__('Title')}}</th>
|
||||
<th>{{__('Course')}}</th>
|
||||
<th>{{__('Lesson')}}</th>
|
||||
<th>{{__('Material Type')}}</th>
|
||||
<th>{{__('Content')}}</th>
|
||||
<th>{{__('Content Url')}}</th>
|
||||
@ -65,7 +65,7 @@ class="nav-link btn-primary">Grid
|
||||
<tr>
|
||||
<td>{{$m->id}}</td>
|
||||
<td>{{$m->title}}</td>
|
||||
<td>{{$m->course?->title_en}}</td>
|
||||
<td>{{$m->lesson?->title}}</td>
|
||||
<td>
|
||||
{{ $m->type == 'video' ? __('Video') : ($m->type == 'document' ?
|
||||
__('Document') : __('Quiz')) }}
|
||||
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user