/** * Display a listing of the resource. * * @return Response */ public function index() { error_reporting(0); $today = date('Y-m-d', time()); $pic = Pic::whereBetween('created_at', [$today . ' 00:00:01', $today . ' 23:59:59'])->get(); return view('welcome')->with(compact('pic')); }
/** * show topic index page * * @return Response */ public function index() { // get topic info $today = date('Y-m-d', time()); $topic = Pic::select('topic', 'id')->whereBetween('created_at', [$today . ' 00:00:01', $today . ' 23:59:59'])->first(); // get talks $hotesttalk = Talks::orderBy('upnum', 'desc')->first(); $talks = Talks::where('tid', $topic->id)->orderBy('created_at', 'desc')->paginate(20); return view('show.topics')->with(compact('topic', 'hotesttalk', 'talks')); }
public function store_pictorial(Request $request) { $pic = $request->file('pic'); $Extension = $pic->getClientOriginalExtension(); $fileName = date('Y-m-d', time()) . '-' . rand(1, 99999); $clientName = $fileName . '.' . $Extension; $pic->move('./uploads/images/' . date('Y', time()), $clientName); $pic = new Pic(); $pic->title = $request->title; $pic->content = $request->input('content'); $pic->tags = $request->input('tags'); $pic->path = '/uploads/images/' . date('Y', time()) . '/' . $clientName; $pic->author = $request->input('author'); if ($pic->save()) { echo 'done'; //return redirect('/admin/pic/index'); } else { echo 'please retry'; } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $pics = Pic::select('id', 'title', 'author', 'content', 'path', 'created_at', 'tags')->orderBy('created_at', 'desc')->paginate(6); return view('show.index')->with(compact('pics')); }