Add new version in repository
This commit is contained in:
68
app/Http/Controllers/Admin/Shop/ArticleController.php
Normal file
68
app/Http/Controllers/Admin/Shop/ArticleController.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\Repositories\Shop\ArticleNatures;
|
||||
use App\Datatables\Shop\ArticlesDataTable;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
public function autocomplete(Request $request, $str = false)
|
||||
{
|
||||
$str = $str ? $str : $request->input('q');
|
||||
return response()->json(Articles::autocomplete($str));
|
||||
}
|
||||
|
||||
public function index(ArticlesDataTable $dataTable)
|
||||
{
|
||||
$data['families'] = ArticleNatures::getOptions();
|
||||
return $dataTable->render('Admin.Shop.Articles.list', $data);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Articles::getMeta();
|
||||
return view('Admin.Shop.Articles.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Articles::storeFull($data);
|
||||
return redirect()->route('Admin.Shop.Articles.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Articles::get($id);
|
||||
return view('Admin.Shop.Articles.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Articles::getFull($id);
|
||||
return view('Admin.Shop.Articles.edit', $data);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Articles::destroy($id);
|
||||
}
|
||||
|
||||
public function getImages(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data['images'] = Articles::getImages($id);
|
||||
return view('components.uploader.mini-gallery-items', $data);
|
||||
}
|
||||
|
||||
public function deleteImage(Request $request)
|
||||
{
|
||||
$id = $request->input('id');
|
||||
$index = $request->input('index');
|
||||
return Articles::deleteImage($id, $index);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user