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

@ -40,8 +40,14 @@ public function store(AddNewRequest $request)
$material->title = $request->materialTitle; $material->title = $request->materialTitle;
$material->course_id = $request->courseId; $material->course_id = $request->courseId;
$material->type = $request->materialType; $material->type = $request->materialType;
$material->content = $request->content;
$material->content_url = $request->contentURL; $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()) { if ($material->save()) {
$this->notice::success('Data Saved'); $this->notice::success('Data Saved');
return redirect()->route('material.index'); return redirect()->route('material.index');
@ -86,6 +92,11 @@ public function update(UpdateRequest $request, $id)
$material->type = $request->materialType; $material->type = $request->materialType;
$material->content_url = $request->contentURL; $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()) { if ($material->save()) {
$this->notice::success('Data Saved'); $this->notice::success('Data Saved');
return redirect()->route('material.index'); return redirect()->route('material.index');

Voir le fichier

@ -16,6 +16,7 @@ public function up(): void
$table->unsignedBigInteger('course_id')->index(); $table->unsignedBigInteger('course_id')->index();
$table->string('title', 255)->nullable(false); $table->string('title', 255)->nullable(false);
$table->enum('type', ['video', 'document', 'quiz'])->nullable(false); $table->enum('type', ['video', 'document', 'quiz'])->nullable(false);
$table->string('content')->nullable();
$table->text('content_url')->nullable(); $table->text('content_url')->nullable();
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $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> </select>
</div> </div>
</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="col-lg-6 col-md-6 col-sm-12">
<div class="form-group"> <div class="form-group">
<label class="form-label">Content Url</label> <label class="form-label">Content Url</label>

Voir le fichier

@ -87,6 +87,12 @@
<span class="text-danger"> {{ $errors->first('materialType') }}</span> <span class="text-danger"> {{ $errors->first('materialType') }}</span>
@endif @endif
</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="col-lg-6 col-md-6 col-sm-12">
<div class="form-group"> <div class="form-group">
<label class="form-label">Content Url</label> <label class="form-label">Content Url</label>

Voir le fichier

@ -55,6 +55,7 @@ class="nav-link btn-primary">Grid
<th>{{__('Title')}}</th> <th>{{__('Title')}}</th>
<th>{{__('Course')}}</th> <th>{{__('Course')}}</th>
<th>{{__('Material Type')}}</th> <th>{{__('Material Type')}}</th>
<th>{{__('Content')}}</th>
<th>{{__('Content Url')}}</th> <th>{{__('Content Url')}}</th>
<th>{{__('Action')}}</th> <th>{{__('Action')}}</th>
</tr> </tr>
@ -69,6 +70,11 @@ class="nav-link btn-primary">Grid
{{ $m->type == 'video' ? __('Video') : ($m->type == 'document' ? {{ $m->type == 'video' ? __('Video') : ($m->type == 'document' ?
__('Document') : __('Quiz')) }} __('Document') : __('Quiz')) }}
</td> </td>
<td>
<embed
src="{{asset('public/uploads/courses/contents/'.$m->content)}}"
width="100px" height="50px" />
</td>
<td>{{$m->content_url}}</td> <td>{{$m->content_url}}</td>
<td> <td>
<a href="{{route('material.edit', encryptor('encrypt',$m->id))}}" <a href="{{route('material.edit', encryptor('encrypt',$m->id))}}"