edited course materials

Cette révision appartient à :
Ibrahim Khail Shakil 2023-12-17 10:41:52 +06:00
Parent 664b7d9cf7
révision f8e1270a03
8 fichiers modifiés avec 33 ajouts et 3 suppressions

Voir le fichier

@ -15,7 +15,7 @@ class MaterialController extends Controller
/**
* Display a listing of the resource.
*/
public function index()
public function index()
{
$material = Material::paginate(10);
return view('backend.course.material.index', compact('material'));
@ -40,10 +40,16 @@ public function store(AddNewRequest $request)
$material->title = $request->materialTitle;
$material->course_id = $request->courseId;
$material->type = $request->materialType;
$material->content = $request->content;
$material->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);
$material->content = $contentName;
}
if ($material->save()) {
$this->notice::success('Data Saved');
$this->notice::success('Data Saved');
return redirect()->route('material.index');
} else {
$this->notice::error('Please try again');
@ -86,6 +92,11 @@ public function update(UpdateRequest $request, $id)
$material->type = $request->materialType;
$material->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);
$material->content = $contentName;
}
if ($material->save()) {
$this->notice::success('Data Saved');
return redirect()->route('material.index');

Voir le fichier

@ -16,6 +16,7 @@ public function up(): void
$table->unsignedBigInteger('course_id')->index();
$table->string('title', 255)->nullable(false);
$table->enum('type', ['video', 'document', 'quiz'])->nullable(false);
$table->string('content')->nullable();
$table->text('content_url')->nullable();
$table->timestamps();
$table->softDeletes();

Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 176 KiB

Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 176 KiB

Fichier binaire non affiché.

Voir le fichier

@ -80,6 +80,12 @@
</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>

Voir le fichier

@ -87,6 +87,12 @@
<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>

Voir le fichier

@ -55,6 +55,7 @@ class="nav-link btn-primary">Grid
<th>{{__('Title')}}</th>
<th>{{__('Course')}}</th>
<th>{{__('Material Type')}}</th>
<th>{{__('Content')}}</th>
<th>{{__('Content Url')}}</th>
<th>{{__('Action')}}</th>
</tr>
@ -64,11 +65,16 @@ class="nav-link btn-primary">Grid
<tr>
<td>{{$m->id}}</td>
<td>{{$m->title}}</td>
<td>{{$m->course?->title_en}}</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))}}"