Applied fixes from StyleCI

This commit is contained in:
Sujit Prasad
2016-02-19 02:20:12 -05:00
committed by StyleCI Bot
parent be5df5334f
commit d637c2b23f
439 changed files with 19063 additions and 19210 deletions

View File

@@ -5,8 +5,8 @@ namespace App\Http\Controllers\Client\kb;
use App\Http\Controllers\Controller;
use App\Http\Requests\kb\CommentRequest;
use App\Http\Requests\kb\ContactRequest;
use App\Http\Requests\kb\SearchRequest;
use App\Http\Requests\kb\ProfilePassword;
use App\Http\Requests\kb\SearchRequest;
use App\Model\kb\Article;
use App\Model\kb\Category;
use App\Model\kb\Comment;
@@ -15,18 +15,18 @@ use App\Model\kb\Faq;
use App\Model\kb\Page;
use App\Model\kb\Relationship;
use App\Model\kb\Settings;
use Config;
use Auth;
// use Creativeorange\Gravatar\Gravatar;
use Config;
use Hash;
use Illuminate\Http\Request;
use Mail;
use Auth;
use Redirect;
use Hash;
use Exception;
class UserController extends Controller {
public function __construct() {
class UserController extends Controller
{
public function __construct()
{
//$this->middleware('auth');
//SettingsController::language();
// $this->port();
@@ -38,11 +38,11 @@ class UserController extends Controller {
/**
* @param
*
* @return response
* @package default
*/
public function getArticle(Article $article, Category $category, Settings $settings) {
public function getArticle(Article $article, Category $category, Settings $settings)
{
$settings = $settings->first();
$pagination = $settings->pagination;
// $article = $article->where('status', '1');
@@ -56,14 +56,16 @@ class UserController extends Controller {
}
/**
* Get excerpt from string
* Get excerpt from string.
*
* @param String $str String to get an excerpt from
* @param Integer $startPos Position int string to start excerpt from
* @param Integer $maxLength Maximum length the excerpt may be
* @return String excerpt
* @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
*/
static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
{
if (strlen($str) > $maxLength) {
$excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' ');
@@ -76,7 +78,8 @@ class UserController extends Controller {
return $excerpt;
}
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
{
$settings = $settings->first();
$pagination = $settings->pagination;
$search = $request->input('s');
@@ -84,14 +87,17 @@ class UserController extends Controller {
$result->setPath('search');
//dd($result);
$categorys = $category->get();
return view('themes.default1.client.kb.article-list.search', compact('categorys', 'result'));
}
/**
* to show the seleted article
* to show the seleted article.
*
* @return response
*/
public function show($slug, Article $article, Category $category) {
public function show($slug, Article $article, Category $category)
{
//ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
@@ -105,7 +111,8 @@ class UserController extends Controller {
}
}
public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
public function getCategory($slug, Article $article, Category $category, Relationship $relation)
{
/* get the article_id where category_id == current category */
$catid = $category->where('slug', $slug)->first();
$id = $catid->id;
@@ -118,7 +125,8 @@ class UserController extends Controller {
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
}
public function home(Article $article, Category $category, Relationship $relation) {
public function home(Article $article, Category $category, Relationship $relation)
{
if (Config::get('database.install') == '%0%') {
return redirect('step1');
} else {
@@ -130,27 +138,34 @@ class UserController extends Controller {
}
}
public function Faq(Faq $faq, Category $category) {
public function Faq(Faq $faq, Category $category)
{
$faq = $faq->where('id', '1')->first();
$categorys = $category->get();
return view('themes.default1.client.kb.article-list.faq', compact('categorys', 'faq'));
}
/**
* get the contact page for user
* get the contact page for user.
*
* @return response
*/
public function contact(Category $category, Settings $settings) {
public function contact(Category $category, Settings $settings)
{
$settings = $settings->whereId('1')->first();
$categorys = $category->get();
return view('themes.default1.client.kb.article-list.contact', compact('settings', 'categorys'));
}
/**
* send message to the mail adderess that define in the system
* send message to the mail adderess that define in the system.
*
* @return response
*/
public function postContact(ContactRequest $request, Contact $contact) {
public function postContact(ContactRequest $request, Contact $contact)
{
$this->port();
$this->host();
$this->encryption();
@@ -167,7 +182,7 @@ class UserController extends Controller {
$details = $request->input('message');
//echo $message;
//echo $contact->email;
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', array('name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details), function ($message) use ($contact) {
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
$message->to($contact->email, $contact->name)->subject('Contact');
});
if ($mail) {
@@ -177,19 +192,23 @@ class UserController extends Controller {
}
}
public function contactDetails() {
public function contactDetails()
{
return view('themes.default1.client.kb.article-list.contact-details');
}
/**
* To insert the values to the comment table
* To insert the values to the comment table.
*
* @param type Article $article
* @param type Request $request
* @param type Comment $comment
* @param type Id $id
* @param type Id $id
*
* @return type response
*/
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
{
$article = $article->where('slug', $slug)->first();
$id = $article->id;
$comment->article_id = $id;
@@ -200,39 +219,46 @@ class UserController extends Controller {
}
}
public function getPage($name, Page $page) {
public function getPage($name, Page $page)
{
$page = $page->where('slug', $name)->first();
//$this->timezone($page->created_at);
return view('themes.default1.client.kb.article-list.pages', compact('page'));
}
static function port() {
public static function port()
{
$setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port);
}
static function host() {
public static function host()
{
$setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host);
}
static function encryption() {
public static function encryption()
{
$setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
}
static function email() {
public static function email()
{
$setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail'));
}
static function password() {
public static function password()
{
$setting = Settings::whereId('1')->first();
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
}
public function getCategoryList(Article $article, Category $category, Relationship $relation) {
public function getCategoryList(Article $article, Category $category, Relationship $relation)
{
//$categorys = $category->get();
$categorys = $category->get();
// $categorys->setPath('home');
@@ -254,12 +280,15 @@ class UserController extends Controller {
// //return substr($date, 0, -6);
// }
public function clientProfile() {
public function clientProfile()
{
$user = Auth::user();
return view('themes.default1.client.kb.article-list.profile', compact('user'));
}
public function postClientProfile($id, ProfileRequest $request) {
public function postClientProfile($id, ProfileRequest $request)
{
$user = Auth::user();
$user->gender = $request->input('gender');
$user->save();
@@ -278,12 +307,13 @@ class UserController extends Controller {
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999) . '.' . $name;
$fileName = rand(0000, 9999).'.'.$name;
//echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName;
} else {
$user->fill($request->except('profile_pic', 'gender'))->save();
return redirect('guest')->with('success', 'Profile Updated sucessfully');
}
if ($user->fill($request->except('profile_pic'))->save()) {
@@ -291,16 +321,17 @@ class UserController extends Controller {
}
}
public function postClientProfilePassword($id, ProfilePassword $request) {
public function postClientProfilePassword($id, ProfilePassword $request)
{
$user = Auth::user();
//echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
$user->password = Hash::make($request->input('new_password'));
$user->save();
return redirect()->back()->with('success', 'Password Updated sucessfully');
} else {
return redirect()->back()->with('fails', 'Password was not Updated');
}
}
}