Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
@@ -31,14 +31,13 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$setting = $settings->first();
|
||||
$pagination = $setting->pagination;
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
if (! Auth::check() || \Auth::user()->role == 'user') {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
$article = $article->where('type', '1');
|
||||
@@ -54,10 +53,9 @@ class UserController extends Controller
|
||||
/**
|
||||
* Get excerpt from string.
|
||||
*
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
*
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
* @return string excerpt
|
||||
*/
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
|
||||
@@ -77,11 +75,10 @@ class UserController extends Controller
|
||||
/**
|
||||
* function to search an article.
|
||||
*
|
||||
* @param \App\Http\Requests\kb\SearchRequest $request
|
||||
* @param \App\Model\kb\Category $category
|
||||
* @param \App\Model\kb\Article $article
|
||||
* @param \App\Model\kb\Settings $settings
|
||||
*
|
||||
* @param \App\Http\Requests\kb\SearchRequest $request
|
||||
* @param \App\Model\kb\Category $category
|
||||
* @param \App\Model\kb\Article $article
|
||||
* @param \App\Model\kb\Settings $settings
|
||||
* @return type view
|
||||
*/
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
|
||||
@@ -113,7 +110,7 @@ class UserController extends Controller
|
||||
$date = \Carbon\Carbon::now()->toDateTimeString();
|
||||
$arti = $article->where('slug', $slug);
|
||||
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
if (! Auth::check() || \Auth::user()->role == 'user') {
|
||||
$arti = $arti->where('status', '1');
|
||||
$arti = $arti->where('publish_time', '<', $date);
|
||||
}
|
||||
@@ -133,7 +130,7 @@ class UserController extends Controller
|
||||
{
|
||||
/* get the article_id where category_id == current category */
|
||||
$catid = $category->where('slug', $slug)->first();
|
||||
if (!$catid) {
|
||||
if (! $catid) {
|
||||
return redirect()->back()->with('fails', Lang::get('lang.we_are_sorry_but_the_page_you_are_looking_for_can_not_be_found'));
|
||||
}
|
||||
$id = $catid->id;
|
||||
@@ -225,13 +222,12 @@ class UserController extends Controller
|
||||
* @param type Request $request
|
||||
* @param type Comment $comment
|
||||
* @param type Id $id
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
|
||||
{
|
||||
$article = $article->where('slug', $slug)->first();
|
||||
if (!$article) {
|
||||
if (! $article) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
$id = $article->id;
|
||||
|
Reference in New Issue
Block a user