mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Use $request instead of Input::
This commit is contained in:
parent
eb9207d0fe
commit
1ab414453f
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Input;
|
|
||||||
use Lang;
|
use Lang;
|
||||||
use App\Models\Depreciation;
|
use App\Models\Depreciation;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
@ -10,6 +9,7 @@ use DB;
|
||||||
use Str;
|
use Str;
|
||||||
use View;
|
use View;
|
||||||
use Auth;
|
use Auth;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller handles all actions related to Depreciations for
|
* This controller handles all actions related to Depreciations for
|
||||||
|
@ -58,7 +58,7 @@ class DepreciationsController extends Controller
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function postCreate()
|
public function postCreate(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get the POST data
|
// get the POST data
|
||||||
|
@ -68,8 +68,8 @@ class DepreciationsController extends Controller
|
||||||
$depreciation = new Depreciation();
|
$depreciation = new Depreciation();
|
||||||
|
|
||||||
// Depreciation data
|
// Depreciation data
|
||||||
$depreciation->name = e(Input::get('name'));
|
$depreciation->name = e($request->input('name'));
|
||||||
$depreciation->months = e(Input::get('months'));
|
$depreciation->months = e($request->input('months'));
|
||||||
$depreciation->user_id = Auth::user()->id;
|
$depreciation->user_id = Auth::user()->id;
|
||||||
|
|
||||||
// Was the asset created?
|
// Was the asset created?
|
||||||
|
@ -112,7 +112,7 @@ class DepreciationsController extends Controller
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function postEdit($depreciationId = null)
|
public function postEdit(Request $request, $depreciationId = null)
|
||||||
{
|
{
|
||||||
// Check if the depreciation exists
|
// Check if the depreciation exists
|
||||||
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
if (is_null($depreciation = Depreciation::find($depreciationId))) {
|
||||||
|
@ -121,8 +121,8 @@ class DepreciationsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depreciation data
|
// Depreciation data
|
||||||
$depreciation->name = e(Input::get('name'));
|
$depreciation->name = e($request->input('name'));
|
||||||
$depreciation->months = e(Input::get('months'));
|
$depreciation->months = e($request->input('months'));
|
||||||
|
|
||||||
// Was the asset created?
|
// Was the asset created?
|
||||||
if ($depreciation->save()) {
|
if ($depreciation->save()) {
|
||||||
|
@ -176,29 +176,29 @@ class DepreciationsController extends Controller
|
||||||
* @since [v1.2]
|
* @since [v1.2]
|
||||||
* @return String JSON
|
* @return String JSON
|
||||||
*/
|
*/
|
||||||
public function getDatatable()
|
public function getDatatable(Request $request)
|
||||||
{
|
{
|
||||||
$depreciations = Depreciation::select(array('id','name','months'));
|
$depreciations = Depreciation::select(array('id','name','months'));
|
||||||
|
|
||||||
if (Input::has('search')) {
|
if ($request->has('search')) {
|
||||||
$depreciations = $depreciations->TextSearch(e(Input::get('search')));
|
$depreciations = $depreciations->TextSearch(e($request->input('search')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('offset')) {
|
if ($request->has('offset')) {
|
||||||
$offset = e(Input::get('offset'));
|
$offset = e($request->input('offset'));
|
||||||
} else {
|
} else {
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('limit')) {
|
if ($request->has('limit')) {
|
||||||
$limit = e(Input::get('limit'));
|
$limit = e($request->input('limit'));
|
||||||
} else {
|
} else {
|
||||||
$limit = 50;
|
$limit = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_columns = ['id','name','months'];
|
$allowed_columns = ['id','name','months'];
|
||||||
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
|
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
|
||||||
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'created_at';
|
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
|
||||||
|
|
||||||
$depreciations->orderBy($sort, $order);
|
$depreciations->orderBy($sort, $order);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue