Merge pull request #393 from ladybirdweb/analysis-8QPn0P

Apply fixes from StyleCI
This commit is contained in:
Manish Verma
2017-01-28 11:29:10 +05:30
committed by GitHub
4 changed files with 49 additions and 40 deletions

View File

@@ -30,7 +30,6 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
if (env('DB_INSTALL') == 1) { if (env('DB_INSTALL') == 1) {
if ($this->getCurrentQueue() != 'sync') { if ($this->getCurrentQueue() != 'sync') {
$schedule->command('queue:listen '.$this->getCurrentQueue().' --sleep 60')->everyMinute(); $schedule->command('queue:listen '.$this->getCurrentQueue().' --sleep 60')->everyMinute();
} }

View File

@@ -11,24 +11,26 @@ use Lang;
use RecursiveDirectoryIterator; use RecursiveDirectoryIterator;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
class SettingsController extends Controller { class SettingsController extends Controller
{
public function settingsIcon() { public function settingsIcon()
{
return ' <div class="col-md-2 col-sm-6"> return ' <div class="col-md-2 col-sm-6">
<div class="settingiconblue"> <div class="settingiconblue">
<div class="settingdivblue"> <div class="settingdivblue">
<a href="' . url('storage') . '"> <a href="'.url('storage').'">
<span class="fa-stack fa-2x"> <span class="fa-stack fa-2x">
<i class="fa fa-save fa-stack-1x"></i> <i class="fa fa-save fa-stack-1x"></i>
</span> </span>
</a> </a>
</div> </div>
<p class="box-title" >' . Lang::get('storage::lang.storage') . '</p> <p class="box-title" >'.Lang::get('storage::lang.storage').'</p>
</div> </div>
</div>'; </div>';
} }
public function settings() { public function settings()
{
try { try {
$settings = new CommonSettings(); $settings = new CommonSettings();
$directories = $this->directories(); $directories = $this->directories();
@@ -49,7 +51,8 @@ class SettingsController extends Controller {
} }
} }
public function postSettings(Request $request) { public function postSettings(Request $request)
{
try { try {
$requests = $request->except('_token'); $requests = $request->except('_token');
$this->delete(); $this->delete();
@@ -67,7 +70,8 @@ class SettingsController extends Controller {
} }
} }
public function delete() { public function delete()
{
$settings = CommonSettings::where('option_name', 'storage')->get(); $settings = CommonSettings::where('option_name', 'storage')->get();
if ($settings->count() > 0) { if ($settings->count() > 0) {
foreach ($settings as $setting) { foreach ($settings as $setting) {
@@ -76,15 +80,17 @@ class SettingsController extends Controller {
} }
} }
public function save($key, $value) { public function save($key, $value)
{
CommonSettings::create([ CommonSettings::create([
'option_name' => 'storage', 'option_name' => 'storage',
'optional_field' => $key, 'optional_field' => $key,
'option_value' => $value, 'option_value' => $value,
]); ]);
} }
public function directories($root = '') { public function directories($root = '')
{
if ($root == '') { if ($root == '') {
$root = base_path(); $root = base_path();
} }
@@ -103,12 +109,12 @@ class SettingsController extends Controller {
return $paths; return $paths;
} }
public function attachment() { public function attachment()
{
$storage = new StorageController(); $storage = new StorageController();
$storage->upload(); $storage->upload();
} }
public function activate() public function activate()
{ {
if (!\Schema::hasColumn('ticket_attachment', 'driver')) { if (!\Schema::hasColumn('ticket_attachment', 'driver')) {
@@ -119,5 +125,4 @@ class SettingsController extends Controller {
]); ]);
} }
} }
} }

View File

@@ -338,6 +338,7 @@ class TemplateController extends Controller
]; ];
$this->PhpMailController->sendmail($from, $to_address, $message, [], []); $this->PhpMailController->sendmail($from, $to_address, $message, [], []);
return redirect()->back()->with('success', 'Mail has send successfully'); return redirect()->back()->with('success', 'Mail has send successfully');
} catch (Exception $e) { } catch (Exception $e) {
return redirect()->back()->with('fails', $e->getMessage()); return redirect()->back()->with('fails', $e->getMessage());

View File

@@ -35,15 +35,16 @@ use Redirect;
* *
* @author Ladybird <info@ladybirdweb.com> * @author Ladybird <info@ladybirdweb.com>
*/ */
class FormController extends Controller { class FormController extends Controller
{
/** /**
* Create a new controller instance. * Create a new controller instance.
* Constructor to check. * Constructor to check.
* *
* @return void * @return void
*/ */
public function __construct(TicketWorkflowController $TicketWorkflowController) { public function __construct(TicketWorkflowController $TicketWorkflowController)
{
$this->middleware('board'); $this->middleware('board');
// creating a TicketController instance // creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController; $this->TicketWorkflowController = $TicketWorkflowController;
@@ -56,7 +57,8 @@ class FormController extends Controller {
* *
* @return type * @return type
*/ */
public function getForm(Help_topic $topic, CountryCode $code) { public function getForm(Help_topic $topic, CountryCode $code)
{
if (\Config::get('database.install') == '%0%') { if (\Config::get('database.install') == '%0%') {
return \Redirect::route('licence'); return \Redirect::route('licence');
} }
@@ -90,13 +92,13 @@ class FormController extends Controller {
* *
* @return type string * @return type string
*/ */
public function postForm($id, Help_topic $topic) { public function postForm($id, Help_topic $topic)
{
if ($id != 0) { if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first(); $helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form; $custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get(); $values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) { if (!$values) {
} }
if ($values) { if ($values) {
foreach ($values as $form_data) { foreach ($values as $form_data) {
@@ -104,29 +106,29 @@ class FormController extends Controller {
$form_fields = explode(',', $form_data->value); $form_fields = explode(',', $form_data->value);
$var = ''; $var = '';
foreach ($form_fields as $form_field) { foreach ($form_fields as $form_field) {
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>'; $var .= '<option value="'.$form_field.'">'.$form_field.'</option>';
} }
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><select class="form-control" name="'.$form_data->name.'">'.$var.'</select>';
} elseif ($form_data->type == 'radio') { } elseif ($form_data->type == 'radio') {
$type2 = $form_data->value; $type2 = $form_data->value;
$vals = explode(',', $type2); $vals = explode(',', $type2);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
foreach ($vals as $val) { foreach ($vals as $val) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $form_data->value . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$form_data->value.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
} }
echo '<br/>'; echo '<br/>';
} elseif ($form_data->type == 'textarea') { } elseif ($form_data->type == 'textarea') {
$type3 = $form_data->value; $type3 = $form_data->value;
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>'; echo '<br/><label>'.$form_data->label.'</label></br><textarea id="unique-textarea" name="'.$form_data->name.'" class="form-control" style="height:15%;"></textarea>';
} elseif ($form_data->type == 'checkbox') { } elseif ($form_data->type == 'checkbox') {
$type4 = $form_data->value; $type4 = $form_data->value;
$checks = explode(',', $type4); $checks = explode(',', $type4);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>'; echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
foreach ($checks as $check) { foreach ($checks as $check) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">&nbsp&nbsp' . $check; echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'">&nbsp&nbsp'.$check;
} }
} else { } else {
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />'; echo '<br/><label>'.ucfirst($form_data->label).'</label><input type="'.$form_data->type.'" class="form-control" name="'.$form_data->name.'" />';
} }
} }
echo '<br/><br/>'; echo '<br/><br/>';
@@ -142,7 +144,8 @@ class FormController extends Controller {
* @param type Request $request * @param type Request $request
* @param type User $user * @param type User $user
*/ */
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) { public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
{
try { try {
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code', 'priority', 'attachment'); $form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token', 'mobile', 'Code', 'priority', 'attachment');
$name = $request->input('Name'); $name = $request->input('Name');
@@ -200,8 +203,8 @@ class FormController extends Controller {
$geoipcode = $code->where('iso', '=', $location->iso_code)->first(); $geoipcode = $code->where('iso', '=', $location->iso_code)->first();
if ($phonecode == null) { if ($phonecode == null) {
$data = [ $data = [
'fails' => Lang::get('lang.country-code-required-error'), 'fails' => Lang::get('lang.country-code-required-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -210,8 +213,8 @@ class FormController extends Controller {
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get(); $code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
if (!count($code)) { if (!count($code)) {
$data = [ $data = [
'fails' => Lang::get('lang.incorrect-country-code-error'), 'fails' => Lang::get('lang.incorrect-country-code-error'),
'phonecode' => $geoipcode->phonecode, 'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1, 'country_code_error' => 1,
]; ];
@@ -238,7 +241,7 @@ class FormController extends Controller {
} }
} }
// dd($result); // dd($result);
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference')); return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference'));
} else { } else {
return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken')); return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken'));
} }
@@ -255,13 +258,14 @@ class FormController extends Controller {
* *
* @return type view * @return type view
*/ */
public function post_ticket_reply($id, Request $request) { public function post_ticket_reply($id, Request $request)
{
try { try {
if ($comment != null) { if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first(); $tickets = Tickets::where('id', '=', $id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first(); $thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
$subject = $thread->title . '[#' . $tickets->ticket_number . ']'; $subject = $thread->title.'[#'.$tickets->ticket_number.']';
$body = $request->input('comment'); $body = $request->input('comment');
$user_cred = User::where('id', '=', $tickets->user_id)->first(); $user_cred = User::where('id', '=', $tickets->user_id)->first();
@@ -295,7 +299,8 @@ class FormController extends Controller {
} }
} }
public function getCustomForm(Request $request) { public function getCustomForm(Request $request)
{
$html = ''; $html = '';
$helptopic_id = $request->input('helptopic'); $helptopic_id = $request->input('helptopic');
$helptopics = new Help_topic(); $helptopics = new Help_topic();
@@ -313,5 +318,4 @@ class FormController extends Controller {
return $html; return $html;
} }
} }