[PHP] [BiuldYourFirstApp] to build your first application: tracking notification single article this article applies to beginners who have a certain understanding of PHP and laravel frameworks and have read the laravel getting started video: Laravel 5 Fundamentals. This article describes how to build a web application with simple registration, logon, form filling, text generation, preview, email sending, and display.
The video of the video author is often illegally uploaded to youtube. if you want to report to the relevant authorities, you must fill in a DMCA file with the source video address and the video address illegally uploaded, and express some demands. For convenience, the website is designed to enter a form to automatically generate DMCA files and send emails automatically.
If you haven't seen it yet, please download and watch it first:
- Link: http://pan.baidu.com/s/1sjXeLQH
- Password extraction: jjb5
1. modify the style of the returned data and return the View notices. index.
Middleware ('auth'); // register a middleware to verify all methods. parent ::__ construct ();} public function index () {$ notices = $ this-> user-> notices ()-> latest ()-> get (); // sort notices return view ('Notices. index', compact ('notices');} public function create () {// get list of providers $ provider = Provider: list ('name ', 'id'); // load a view to create a new notice return view ('Notices. create ', compact ('Providers');} pubilcfunction confirm (PrepareNoticeRequest $ request) {$ template = $ this-> compileDmcaTemplate ($ data = $ request-> all (); session ()-> flash ('dmca ', $ data ); return view ('Notices. comfirm', compact ('Template'); // return a new view page and check the filled form data} public function store () {$ this-> creaeNotice ($ request); return redirect ('notices');} public function compileDmcaTemplate ($ data) {$ data = $ data + ['name' => $ this-> user-> name, 'Email '=> $ this-> user-> email,]; // input data for the template and splice the data return view ()-> file (app_path ('http/Templates/dmca. blade. php '), $ data);} private function createNotice (Request $ request) {$ notice = session ()-> get ('dmca ') + ['template' => $ request-> input ('Template')]; $ notice = $ this-> user-> notices ()-> save ($ notice ); return $ notice ;}}
2. create the view file index. blade. php.
@extends('app') @section('content') YourNotices
This Content: AccessibleHere: Is InfringingUponMyWorkHere: NoticeSent: ContentRemoved: @foreach ($noticesas $notice) {{ $notice->infringing_title }} {!! link_to($notice->infringing_link) !!} {!! link_to($notice->original_link) !!} {{ $notice->created_at->diffForHumans() }} {!! Form::open() !!}
{!! Form::checkbox('content_removed',$notice->content_removed,$notice->content_removed) !!}
{!! Form::close() !!} @endforeach ($noticesas $notice) @endsection
Summary
This section uses the created view index. blade. php to view sent notifications in descending order.