Exemplo n.º 1
0
 public function destroy($id)
 {
     $cover = Cover::find($id);
     $cover->delete();
     flash()->success('删除成功');
     return redirect()->back();
 }
Exemplo n.º 2
0
 public function update(array $data, $id)
 {
     $cover = Cover::find($id);
     $cover->name = $data['name'];
     $cover->cover_url = $data['cover_url'];
     $cover->display = $data['display'];
     $cover->save();
     return $cover;
 }
Exemplo n.º 3
0
 public function uploadCv($fileName, $image)
 {
     $path = public_path('/images/' . Auth::user()->name);
     File::exists($path) or File::makeDirectory($path, 0755, true);
     $image->save($path . '/' . $fileName)->resize(700, 178)->save($path . '/' . 'cv.jpg');
     if (Auth::user()->cover == null) {
         $picture = new Cover();
         $picture->user_id = Auth::user()->id;
         $picture->thumbnailName = 'images/' . Auth::user()->name . '/cv.jpg';
         $picture->save();
     } else {
         $picture = Cover::where('user_id', Auth::user()->id)->first();
         $picture->user_id = Auth::user()->id;
         $picture->thumbnailName = 'images/' . Auth::user()->name . '/cv.jpg';
         $picture->save();
     }
 }
Exemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return response()->json(Cover::all());
 }
Exemplo n.º 5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getLastCover()
 {
     //
     $cover = Cover::orderBy('created_at', 'desc')->first();
     return response()->json($cover);
 }