mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
Add picture
This commit is contained in:
@@ -17,6 +17,10 @@ class PictureController extends Controller
|
||||
return view('public.allpicture',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||
}
|
||||
|
||||
public function indexAdmin()
|
||||
{
|
||||
return view('admin.picture.index',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||
}
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
@@ -24,7 +28,7 @@ class PictureController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
return view('admin.picture.add');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,9 +37,20 @@ class PictureController extends Controller
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
public function store()
|
||||
{
|
||||
//
|
||||
$pic = new Picture();
|
||||
|
||||
$pic->title = request('title');
|
||||
$pic->url = request('url');
|
||||
$pic->desc = request('desc');
|
||||
$pic->pictureable_id = 0;
|
||||
$pic->pictureable_type = "";
|
||||
|
||||
$pic->save();
|
||||
|
||||
return redirect('/admin/picture')->with('success','Image ajoutée avec succès');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +70,9 @@ class PictureController extends Controller
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Picture $picture)
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
return view('admin.picture.edit',['picture' => Picture::find($id)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,9 +82,17 @@ class PictureController extends Controller
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Picture $picture)
|
||||
public function update($id)
|
||||
{
|
||||
//
|
||||
$pic = Picture::find($id);
|
||||
|
||||
$pic->title = request('title');
|
||||
$pic->url = request('url');
|
||||
$pic->desc = request('desc');
|
||||
|
||||
$pic->save();
|
||||
|
||||
return redirect('/admin/picture')->with('success','Image sauvegarder avec succès');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,8 +101,10 @@ class PictureController extends Controller
|
||||
* @param \App\Picture $picture
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Picture $picture)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$pic = Picture::find($id);
|
||||
|
||||
$pic->delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user