edited course materials
Cette révision appartient à :
Parent
664b7d9cf7
révision
f8e1270a03
@ -15,7 +15,7 @@ class MaterialController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$material = Material::paginate(10);
|
$material = Material::paginate(10);
|
||||||
return view('backend.course.material.index', compact('material'));
|
return view('backend.course.material.index', compact('material'));
|
||||||
@ -40,10 +40,16 @@ 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');
|
||||||
} else {
|
} else {
|
||||||
$this->notice::error('Please try again');
|
$this->notice::error('Please try again');
|
||||||
@ -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');
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
BIN
public/uploads/courses/contents/4051702787557.jpg
Fichier normal
BIN
public/uploads/courses/contents/4051702787557.jpg
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 176 KiB |
BIN
public/uploads/courses/contents/4781702787823.jpg
Fichier normal
BIN
public/uploads/courses/contents/4781702787823.jpg
Fichier normal
Fichier binaire non affiché.
|
Après Largeur: | Hauteur: | Taille: 176 KiB |
BIN
public/uploads/courses/contents/8721702788050.mp4
Fichier normal
BIN
public/uploads/courses/contents/8721702788050.mp4
Fichier normal
Fichier binaire non affiché.
@ -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>
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
@ -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>
|
||||||
@ -64,11 +65,16 @@ class="nav-link btn-primary">Grid
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{$m->id}}</td>
|
<td>{{$m->id}}</td>
|
||||||
<td>{{$m->title}}</td>
|
<td>{{$m->title}}</td>
|
||||||
<td>{{$m->course?->title_en}}</td>
|
<td>{{$m->course?->title_en}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ $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))}}"
|
||||||
|
|||||||
Chargement…
Référencer dans un nouveau ticket
Block a user