当前位置: 首页 > 后端技术 > PHP

在laravel中使用WangEditor和多图上传(下)

时间:2023-03-30 01:29:37 PHP

laravel中WangEditor的使用与多图上传(下)一、快速生成前端文章1.1创建路由Route::resource('/article','ArticleController');1.2快速生成文章控制器ArticleControllerphpartisanmake:controllerArticleController1.3修改文章控制器app/Http/ArticleController.php

文章列表

@forelse($dataas$list)id}}">{{$list->title}}
cover)[0]!!}"style="max-width:100%;overflow:hidden;"alt="">
@empty

什么都没有:(

@endforelse{{$data->links()}}/div>@endsection详情页resource/view/home/article/list.blade.php@extends('layouts.app')@section('title',"$data->title")@section('content')

详情页

  • {!!$data->title!!

  • @for($i=1;$icover);$i++)@endforcover[0]}}"alt="图1">...
    @对于($i=1;$icover);$i++)cover[$i]}}"alt="图{{$i}}">...@endfor
    上一个下一步
  • {!!$data->content!!}
  • 创建时间:{!!$data->created_at!!}
  • 更新时间:{!!$data->updated_at!!}
  • @endsection这里我们使用resource/layouts/app.php中的bootstrap导航栏引入bootstrap.css效果图2.美化图片显示,添加lightbox2.1添加lightbox.css和lightbox.js添加加载js注意lightbox.js依赖jquery.js,所以必须先加载jquery在视图文件list.blade.php中添加
  • {!!$data->content!!}
  • @foreach($data->coveras$cover)@endforeach最终渲染原文链接https://www.bear777.com/blog/laravel-wangeditor-1github地址https://github.com/pandoraxm/laravel-admin-wangeditor