mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Formatting fixes for coding standards
This commit is contained in:
parent
70aefdc9c0
commit
4ed8ff5576
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Location;
|
||||
use App\Models\Category;
|
||||
|
@ -13,7 +14,8 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
use Illuminate\Console\Command;
|
||||
use League\Csv\Reader;
|
||||
|
||||
class AssetImportCommand extends Command {
|
||||
class AssetImportCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
@ -277,8 +279,7 @@ class AssetImportCommand extends Command {
|
|||
|
||||
$location = new Location();
|
||||
|
||||
if ($user_asset_location!='')
|
||||
{
|
||||
if ($user_asset_location!='') {
|
||||
$location->name = e($user_asset_location);
|
||||
$location->address = '';
|
||||
$location->city = '';
|
||||
|
@ -295,14 +296,10 @@ class AssetImportCommand extends Command {
|
|||
$this->error($location->getErrors());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->comment('Location '.$user_asset_location.' was (not) created - test run only');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->comment('No location given, so none created.');
|
||||
}
|
||||
|
||||
|
@ -463,6 +460,4 @@ class AssetImportCommand extends Command {
|
|||
array('testrun', null, InputOption::VALUE_REQUIRED, 'Test the output without writing to the database or not.', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Console\Commands;
|
|||
use Illuminate\Console\Command;
|
||||
use App\Models\Setting;
|
||||
|
||||
|
||||
class DisableLDAP extends Command
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,8 @@ use App\Models\Supplier;
|
|||
use App\Models\License;
|
||||
use App\Models\LicenseSeat;
|
||||
|
||||
class LicenseImportCommand extends Command {
|
||||
class LicenseImportCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
@ -379,6 +380,4 @@ class LicenseImportCommand extends Command {
|
|||
array('testrun', null, InputOption::VALUE_REQUIRED, 'Test the output without writing to the database or not.', null),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ ini_set('memory_limit', '500M');
|
|||
/**
|
||||
* Class ObjectImportCommand
|
||||
*/
|
||||
class ObjectImportCommand extends Command {
|
||||
class ObjectImportCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
@ -84,8 +85,7 @@ class ObjectImportCommand extends Command {
|
|||
$results = $csv->fetchAssoc();
|
||||
$newarray = null;
|
||||
|
||||
foreach ($results as $index => $arraytoNormalize)
|
||||
{
|
||||
foreach ($results as $index => $arraytoNormalize) {
|
||||
$internalnewarray = array_change_key_case($arraytoNormalize);
|
||||
$newarray[$index] = $internalnewarray;
|
||||
}
|
||||
|
@ -198,21 +198,19 @@ class ObjectImportCommand extends Command {
|
|||
|
||||
|
||||
$this->log('=====================================');
|
||||
if(!$this->option('web-importer'))
|
||||
{
|
||||
if (!$this->option('web-importer')) {
|
||||
if (!empty($this->errors)) {
|
||||
$this->comment("The following Errors were encountered.");
|
||||
foreach($this->errors as $asset => $error)
|
||||
{
|
||||
foreach ($this->errors as $asset => $error) {
|
||||
$this->comment('Error: Item: ' . $asset . 'failed validation: ' . json_encode($error));
|
||||
}
|
||||
} else {
|
||||
$this->comment("All Items imported successfully!");
|
||||
}
|
||||
} else {
|
||||
if(empty($this->errors))
|
||||
if (empty($this->errors)) {
|
||||
return 0;
|
||||
else {
|
||||
} else {
|
||||
$this->comment(json_encode($this->errors)); //Send a big string to the
|
||||
return 1;
|
||||
}
|
||||
|
@ -230,9 +228,10 @@ class ObjectImportCommand extends Command {
|
|||
public function jsonError($field, $errorString)
|
||||
{
|
||||
$this->errors[$this->current_assetId][$field] = $errorString;
|
||||
if($this->option('verbose'))
|
||||
if ($this->option('verbose')) {
|
||||
parent::error($field . $errorString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message to file, configurable by the --log-file parameter.
|
||||
|
@ -245,14 +244,13 @@ class ObjectImportCommand extends Command {
|
|||
*/
|
||||
private function log($string, $level = 'info')
|
||||
{
|
||||
if($this->option('web-importer'))
|
||||
if ($this->option('web-importer')) {
|
||||
return;
|
||||
if($level === 'warning')
|
||||
{
|
||||
}
|
||||
if ($level === 'warning') {
|
||||
\Log::warning($string);
|
||||
$this->comment($string);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
\Log::Info($string);
|
||||
if ($this->option('verbose')) {
|
||||
$this->comment($string);
|
||||
|
@ -270,7 +268,8 @@ class ObjectImportCommand extends Command {
|
|||
* @param $default string
|
||||
* @return string
|
||||
*/
|
||||
public function array_smart_fetch(Array $array, $key, $default = '') {
|
||||
public function array_smart_fetch(array $array, $key, $default = '')
|
||||
{
|
||||
return array_key_exists($key, $array) ? e(trim($array[ $key ])) : $default;
|
||||
}
|
||||
|
||||
|
@ -283,7 +282,8 @@ class ObjectImportCommand extends Command {
|
|||
* @param $array array
|
||||
* @return string
|
||||
*/
|
||||
public function array_smart_custom_field_fetch(Array $array, $key) {
|
||||
public function array_smart_custom_field_fetch(array $array, $key)
|
||||
{
|
||||
$index_name = strtolower($key->name);
|
||||
return array_key_exists($index_name, $array) ? e(trim($array[$index_name])) : '';
|
||||
}
|
||||
|
@ -307,10 +307,12 @@ class ObjectImportCommand extends Command {
|
|||
|
||||
$asset_model_name = $this->array_smart_fetch($row, "model name");
|
||||
$asset_modelno = $this->array_smart_fetch($row, "model number");
|
||||
if(empty($asset_model_name))
|
||||
if (empty($asset_model_name)) {
|
||||
$asset_model_name='Unknown';
|
||||
if(empty($asset_modelno))
|
||||
}
|
||||
if (empty($asset_modelno)) {
|
||||
$asset_modelno='';
|
||||
}
|
||||
$this->log('Model Name: ' . $asset_model_name);
|
||||
$this->log('Model No: ' . $asset_modelno);
|
||||
|
||||
|
@ -319,8 +321,7 @@ class ObjectImportCommand extends Command {
|
|||
if ((strcasecmp($tempmodel->name, $asset_model_name) == 0)
|
||||
&& $tempmodel->modelno == $asset_modelno
|
||||
&& $tempmodel->category_id == $category->id
|
||||
&& $tempmodel->manufacturer_id == $manufacturer->id )
|
||||
{
|
||||
&& $tempmodel->manufacturer_id == $manufacturer->id ) {
|
||||
$this->log('A matching model ' . $asset_model_name . ' with model number ' . $asset_modelno . ' already exists');
|
||||
return $tempmodel;
|
||||
}
|
||||
|
@ -362,8 +363,9 @@ class ObjectImportCommand extends Command {
|
|||
*/
|
||||
public function createOrFetchCategory($asset_category, $item_type)
|
||||
{
|
||||
if (empty($asset_category))
|
||||
if (empty($asset_category)) {
|
||||
$asset_category = 'Unnamed Category';
|
||||
}
|
||||
|
||||
foreach ($this->categories as $tempcategory) {
|
||||
if ((strcasecmp($tempcategory->name, $asset_category) == 0) && $tempcategory->category_type === $item_type) {
|
||||
|
@ -441,8 +443,9 @@ class ObjectImportCommand extends Command {
|
|||
*/
|
||||
public function createOrFetchStatusLabel($asset_statuslabel_name)
|
||||
{
|
||||
if(empty($asset_statuslabel_name))
|
||||
if (empty($asset_statuslabel_name)) {
|
||||
return;
|
||||
}
|
||||
foreach ($this->status_labels as $tempstatus) {
|
||||
if (strcasecmp($tempstatus->name, $asset_statuslabel_name) == 0) {
|
||||
$this->log('A matching Status ' . $asset_statuslabel_name . ' already exists');
|
||||
|
@ -582,8 +585,9 @@ class ObjectImportCommand extends Command {
|
|||
public function createOrFetchSupplier(array $row)
|
||||
{
|
||||
$supplier_name = $this->array_smart_fetch($row, "supplier");
|
||||
if(empty($supplier_name))
|
||||
if (empty($supplier_name)) {
|
||||
$supplier_name='Unknown';
|
||||
}
|
||||
foreach ($this->suppliers as $tempsupplier) {
|
||||
if (strcasecmp($tempsupplier->name, $supplier_name) == 0) {
|
||||
$this->log('A matching Company ' . $supplier_name . ' already exists');
|
||||
|
@ -669,8 +673,9 @@ class ObjectImportCommand extends Command {
|
|||
$this->log('Email: ' . $user_email);
|
||||
$this->log('--- End User Data ---');
|
||||
|
||||
if($this->option('testrun'))
|
||||
if ($this->option('testrun')) {
|
||||
return new User;
|
||||
}
|
||||
|
||||
if (!empty($user_username)) {
|
||||
if ($user = User::MatchEmailOrUsername($user_username, $user_email)
|
||||
|
@ -771,20 +776,25 @@ class ObjectImportCommand extends Command {
|
|||
$asset->asset_tag = $item['asset_tag'];
|
||||
$asset->warranty_months = $asset_warranty_months;
|
||||
|
||||
if($asset_model)
|
||||
if ($asset_model) {
|
||||
$asset->model_id = $asset_model->id;
|
||||
if($item["user"])
|
||||
}
|
||||
if ($item["user"]) {
|
||||
$asset->assigned_to = $item["user"]->id;
|
||||
if($item["location"])
|
||||
}
|
||||
if ($item["location"]) {
|
||||
$asset->rtd_location_id = $item["location"]->id;
|
||||
}
|
||||
$asset->user_id = $this->option('user_id');
|
||||
$this->log("status_id: " . $status_id);
|
||||
$asset->status_id = $status_id;
|
||||
if($item["company"])
|
||||
if ($item["company"]) {
|
||||
$asset->company_id = $item["company"]->id;
|
||||
}
|
||||
$asset->order_number = $item["order_number"];
|
||||
if($supplier)
|
||||
if ($supplier) {
|
||||
$asset->supplier_id = $supplier->id;
|
||||
}
|
||||
$asset->notes = $item["notes"];
|
||||
$asset->image = $asset_image;
|
||||
$this->assets->add($asset);
|
||||
|
@ -834,14 +844,17 @@ class ObjectImportCommand extends Command {
|
|||
} else {
|
||||
$accessory->purchase_cost = 0.00;
|
||||
}
|
||||
if($item["location"])
|
||||
if ($item["location"]) {
|
||||
$accessory->location_id = $item["location"]->id;
|
||||
}
|
||||
$accessory->user_id = $this->option('user_id');
|
||||
if($item["company"])
|
||||
if ($item["company"]) {
|
||||
$accessory->company_id = $item["company"]->id;
|
||||
}
|
||||
$accessory->order_number = $item["order_number"];
|
||||
if($item["category"])
|
||||
if ($item["category"]) {
|
||||
$accessory->category_id = $item["category"]->id;
|
||||
}
|
||||
|
||||
//TODO: Implement
|
||||
// $accessory->notes = e($item_notes);
|
||||
|
@ -964,7 +977,4 @@ class ObjectImportCommand extends Command {
|
|||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -55,10 +55,8 @@ class PaveIt extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]"))
|
||||
{
|
||||
if( $this->option('soft'))
|
||||
{
|
||||
if ($this->confirm("\n****************************************************\nTHIS WILL DELETE ALL OF THE DATA IN YOUR DATABASE. \nThere is NO undo. This WILL destroy ALL of your data. \n****************************************************\n\nDo you wish to continue? No backsies! [y|N]")) {
|
||||
if ($this->option('soft')) {
|
||||
Accessory::getQuery()->delete();
|
||||
Asset::getQuery()->delete();
|
||||
Category::getQuery()->delete();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Asset;
|
||||
use App\Models\License;
|
||||
use App\Models\Setting;
|
||||
|
@ -8,7 +9,8 @@ use DB;
|
|||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendExpirationAlerts extends Command {
|
||||
class SendExpirationAlerts extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
@ -128,9 +130,4 @@ class SendExpirationAlerts extends Command {
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -65,5 +65,4 @@ class SendInventoryAlerts extends Command
|
|||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,8 @@ namespace App\Console\Commands;
|
|||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SystemBackup extends Command {
|
||||
class SystemBackup extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
@ -41,7 +42,4 @@ class SystemBackup extends Command {
|
|||
$this->call('backup:run');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class Versioning extends Command {
|
||||
class Versioning extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
|
|
|
@ -80,7 +80,8 @@ class AssetsController extends Controller
|
|||
* @since [v3.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function getAssetByTag() {
|
||||
public function getAssetByTag()
|
||||
{
|
||||
if (Input::get('topsearch')=="true") {
|
||||
$topsearch = true;
|
||||
} else {
|
||||
|
@ -231,8 +232,7 @@ class AssetsController extends Controller
|
|||
// FIXME: No idea why this is returning a Builder error on db_column_name.
|
||||
// Need to investigate and fix. Using static method for now.
|
||||
$model = AssetModel::find($request->get('model_id'));
|
||||
if($model->fieldset)
|
||||
{
|
||||
if ($model->fieldset) {
|
||||
foreach ($model->fieldset->fields as $field) {
|
||||
$asset->{\App\Models\CustomField::name_to_db_name($field->name)} = e($request->input(\App\Models\CustomField::name_to_db_name($field->name)));
|
||||
}
|
||||
|
@ -402,8 +402,7 @@ class AssetsController extends Controller
|
|||
// FIXME: No idea why this is returning a Builder error on db_column_name.
|
||||
// Need to investigate and fix. Using static method for now.
|
||||
$model = AssetModel::find($request->get('model_id'));
|
||||
if($model->fieldset)
|
||||
{
|
||||
if ($model->fieldset) {
|
||||
foreach ($model->fieldset->fields as $field) {
|
||||
$asset->{\App\Models\CustomField::name_to_db_name($field->name)} = e($request->input(\App\Models\CustomField::name_to_db_name($field->name)));
|
||||
// LOG::debug($field->name);
|
||||
|
@ -778,8 +777,9 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
// Check if the uploads directory exists. If not, try to create it.
|
||||
if(!file_exists($path))
|
||||
if (!file_exists($path)) {
|
||||
mkdir($path, 0755);
|
||||
}
|
||||
if ($handle = opendir($path)) {
|
||||
|
||||
/* This is the correct way to loop over the directory. */
|
||||
|
@ -876,19 +876,21 @@ class AssetsController extends Controller
|
|||
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
|
||||
}
|
||||
|
||||
$return = Artisan::call('snipeit:import',
|
||||
$return = Artisan::call(
|
||||
'snipeit:import',
|
||||
['filename'=> config('app.private_uploads').'/imports/assets/'.$filename,
|
||||
'--email_format'=>'firstname.lastname',
|
||||
'--username_format'=>'firstname.lastname',
|
||||
'--web-importer' => true,
|
||||
'--user_id' => Auth::user()->id
|
||||
]);
|
||||
]
|
||||
);
|
||||
$display_output = Artisan::output();
|
||||
$file = config('app.private_uploads').'/imports/assets/'.str_replace('.csv', '', $filename).'-output-'.date("Y-m-d-his").'.txt';
|
||||
file_put_contents($file, $display_output);
|
||||
if( $return === 0) //Success
|
||||
if ($return === 0) { //Success
|
||||
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.import.success'));
|
||||
else if( $return === 1) { // Failure
|
||||
} elseif ($return === 1) { // Failure
|
||||
return redirect()->back()->with('import_errors', json_decode($display_output))->with('error', trans('admin/hardware/message.import.error'));
|
||||
}
|
||||
dd("Shouldn't be here");
|
||||
|
|
|
@ -300,7 +300,8 @@ class CategoriesController extends Controller
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function getDataViewAssets($categoryID) {
|
||||
public function getDataViewAssets($categoryID)
|
||||
{
|
||||
|
||||
$category = Category::with('assets.company')->find($categoryID);
|
||||
$category_assets = $category->assets();
|
||||
|
@ -369,7 +370,8 @@ class CategoriesController extends Controller
|
|||
|
||||
|
||||
|
||||
public function getDataViewAccessories($categoryID) {
|
||||
public function getDataViewAccessories($categoryID)
|
||||
{
|
||||
|
||||
$category = Category::with('accessories.company')->find($categoryID);
|
||||
$category_assets = $category->accessories;
|
||||
|
@ -422,7 +424,8 @@ class CategoriesController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function getDataViewConsumables($categoryID) {
|
||||
public function getDataViewConsumables($categoryID)
|
||||
{
|
||||
|
||||
$category = Category::with('accessories.company')->find($categoryID);
|
||||
$category_assets = $category->consumables;
|
||||
|
@ -474,7 +477,8 @@ class CategoriesController extends Controller
|
|||
return $data;
|
||||
}
|
||||
|
||||
public function getDataViewComponent($categoryID) {
|
||||
public function getDataViewComponent($categoryID)
|
||||
{
|
||||
|
||||
$category = Category::with('accessories.company')->find($categoryID);
|
||||
$category_assets = $category->components;
|
||||
|
@ -525,7 +529,4 @@ class CategoriesController extends Controller
|
|||
$data = array('total' => $count, 'rows' => $rows);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -260,7 +260,8 @@ class CustomFieldsController extends Controller
|
|||
* @since [v3.0]
|
||||
* @return Array
|
||||
*/
|
||||
public function postReorder($id) {
|
||||
public function postReorder($id)
|
||||
{
|
||||
$fieldset=CustomFieldset::find($id);
|
||||
$fields = array();
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use Str;
|
|||
use View;
|
||||
use Auth;
|
||||
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Depreciations for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
|
|
@ -33,7 +33,6 @@ use URL;
|
|||
use View;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Users for
|
||||
* the Snipe-IT Asset Management application.
|
||||
|
@ -523,7 +522,7 @@ class UsersController extends Controller
|
|||
$logaction->logaction('checkin from');
|
||||
}
|
||||
|
||||
LicenseSeat::whereIn('id', $license_array)->update(['assigned_to' => NULL]);
|
||||
LicenseSeat::whereIn('id', $license_array)->update(['assigned_to' => null]);
|
||||
|
||||
foreach ($users as $user) {
|
||||
$user->accessories()->sync(array());
|
||||
|
|
|
@ -7,7 +7,6 @@ use Config;
|
|||
use Route;
|
||||
use Gate;
|
||||
|
||||
|
||||
class CheckPermissions
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Http\Requests;
|
|||
use App\Http\Requests\Request;
|
||||
use App\Models\AssetModel;
|
||||
use Session;
|
||||
|
||||
class AssetRequest extends Request
|
||||
{
|
||||
/**
|
||||
|
@ -40,8 +41,7 @@ class AssetRequest extends Request
|
|||
|
||||
$model = AssetModel::find($this->request->get('model_id'));
|
||||
|
||||
if (($model) && ($model->fieldset))
|
||||
{
|
||||
if (($model) && ($model->fieldset)) {
|
||||
$rules += $model->fieldset->validation_rules();
|
||||
}
|
||||
|
||||
|
|
|
@ -138,14 +138,22 @@ Route::group([ 'prefix' => 'api', 'middleware' => 'auth' ], function () {
|
|||
Route::group([ 'prefix' => 'categories' ], function () {
|
||||
|
||||
Route::get('list', [ 'as' => 'api.categories.list', 'uses' => 'CategoriesController@getDatatable' ]);
|
||||
Route::get( '{categoryID}/asset/view',
|
||||
[ 'as' => 'api.categories.asset.view', 'uses' => 'CategoriesController@getDataViewAssets' ] );
|
||||
Route::get( '{categoryID}/accessory/view',
|
||||
[ 'as' => 'api.categories.accessory.view', 'uses' => 'CategoriesController@getDataViewAccessories' ] );
|
||||
Route::get( '{categoryID}/consumable/view',
|
||||
[ 'as' => 'api.categories.consumable.view', 'uses' => 'CategoriesController@getDataViewConsumables' ] );
|
||||
Route::get( '{categoryID}/component/view',
|
||||
[ 'as' => 'api.categories.component.view', 'uses' => 'CategoriesController@getDataViewComponent' ] );
|
||||
Route::get(
|
||||
'{categoryID}/asset/view',
|
||||
[ 'as' => 'api.categories.asset.view', 'uses' => 'CategoriesController@getDataViewAssets' ]
|
||||
);
|
||||
Route::get(
|
||||
'{categoryID}/accessory/view',
|
||||
[ 'as' => 'api.categories.accessory.view', 'uses' => 'CategoriesController@getDataViewAccessories' ]
|
||||
);
|
||||
Route::get(
|
||||
'{categoryID}/consumable/view',
|
||||
[ 'as' => 'api.categories.consumable.view', 'uses' => 'CategoriesController@getDataViewConsumables' ]
|
||||
);
|
||||
Route::get(
|
||||
'{categoryID}/component/view',
|
||||
[ 'as' => 'api.categories.component.view', 'uses' => 'CategoriesController@getDataViewComponent' ]
|
||||
);
|
||||
});
|
||||
|
||||
/*-- Suppliers API (mostly for creating new ones in-line while creating an asset) --*/
|
||||
|
|
|
@ -172,7 +172,8 @@ class Asset extends Depreciable
|
|||
}
|
||||
|
||||
|
||||
public function getDetailedNameAttribute() {
|
||||
public function getDetailedNameAttribute()
|
||||
{
|
||||
if ($this->assigned_user) {
|
||||
$user_name = $user->fullName();
|
||||
} else {
|
||||
|
@ -542,13 +543,13 @@ class Asset extends Depreciable
|
|||
|
||||
public function scopeAssetsByLocation($query, $location)
|
||||
{
|
||||
return $query->where(function ($query) use ($location)
|
||||
{
|
||||
$query->whereHas('assigneduser', function ($query) use ($location)
|
||||
{
|
||||
return $query->where(function ($query) use ($location) {
|
||||
|
||||
$query->whereHas('assigneduser', function ($query) use ($location) {
|
||||
|
||||
$query->where('users.location_id', '=', $location->id);
|
||||
})->orWhere(function ($query) use ($location)
|
||||
{
|
||||
})->orWhere(function ($query) use ($location) {
|
||||
|
||||
$query->where('assets.rtd_location_id', '=', $location->id);
|
||||
$query->whereNull('assets.assigned_to');
|
||||
});
|
||||
|
|
|
@ -37,7 +37,4 @@ class Group extends Model
|
|||
{
|
||||
return json_decode($this->permissions, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,8 @@ class Setting extends Model
|
|||
return $static_cache;
|
||||
}
|
||||
|
||||
public static function setupCompleted() {
|
||||
public static function setupCompleted()
|
||||
{
|
||||
|
||||
$users_table_exists = Schema::hasTable('users');
|
||||
$settings_table_exists = Schema::hasTable('settings');
|
||||
|
|
|
@ -76,7 +76,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
return false;
|
||||
}
|
||||
|
||||
public function isSuperUser() {
|
||||
public function isSuperUser()
|
||||
{
|
||||
if (!$user_permissions = json_decode($this->permissions, true)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue