101 lines
2.2 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace App\Http\Controllers\Modules;
use App\Http\Controllers\Controller;
use App\Traits\Modules;
use Illuminate\Routing\Route;
2018-04-25 19:28:10 +03:00
use Illuminate\Http\Request;
2017-09-14 22:21:00 +03:00
class Tiles extends Controller
{
use Modules;
/**
* Show the form for viewing the specified resource.
*
* @param $alias
*
* @return Response
*/
public function categoryModules($alias)
2017-09-14 22:21:00 +03:00
{
2017-11-02 02:00:54 +03:00
$this->checkApiToken();
2017-09-14 22:21:00 +03:00
$data = $this->getModulesByCategory($alias);
$title = $data->category->name;
$modules = $data->modules;
return view('modules.tiles.index', compact('title', 'modules'));
}
/**
* Show the form for viewing the specified resource.
*
* @return Response
*/
public function paidModules()
2017-09-14 22:21:00 +03:00
{
2017-11-02 02:00:54 +03:00
$this->checkApiToken();
2017-09-14 22:21:00 +03:00
$title = trans('modules.top_paid');
$modules = $this->getPaidModules();
return view('modules.tiles.index', compact('title', 'modules'));
}
/**
* Show the form for viewing the specified resource.
*
* @return Response
*/
public function newModules()
2017-09-14 22:21:00 +03:00
{
2017-11-02 02:00:54 +03:00
$this->checkApiToken();
2017-09-14 22:21:00 +03:00
$title = trans('modules.new');
$modules = $this->getNewModules();
return view('modules.tiles.index', compact('title', 'modules'));
}
/**
* Show the form for viewing the specified resource.
*
* @return Response
*/
public function freeModules()
2017-09-14 22:21:00 +03:00
{
2017-11-02 02:00:54 +03:00
$this->checkApiToken();
2017-09-14 22:21:00 +03:00
$title = trans('modules.top_free');
$modules = $this->getFreeModules();
return view('modules.tiles.index', compact('title', 'modules'));
}
2018-04-25 19:28:10 +03:00
/**
* Show the form for viewing the specified resource.
*
* @return Response
*/
public function searchModules(Request $request)
{
$this->checkApiToken();
$keyword = $request['keyword'];
$data = [
'query' => [
'keyword' => $keyword,
]
];
$title = trans('modules.search');
$modules = $this->getSearchModules($data);
return view('modules.tiles.index', compact('title', 'modules', 'keyword'));
}
2017-09-14 22:21:00 +03:00
}