- array/string Helpers: Laravel Convert old array and string helpers into their modern class-based methods.
- Use Laravel Carbon: Laravel provides an Illuminate\Support\Carbon class which wraps the underlying Carbon class. By using this class, you gain access to some additional testing methods and create separation between your code and underlying dependencies.
This commit is contained in:
parent
50ceeb193b
commit
7d1406ee5c
|
@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use \Exception;
|
||||
// use Carbon\Carbon;
|
||||
// use Illuminate\Support\Carbon;
|
||||
use \Illuminate\Support\Carbon;
|
||||
|
||||
class RequestController extends Controller
|
||||
|
|
|
@ -18,7 +18,7 @@ use App\Models\User;
|
|||
use App\Rules\RdrFilesize;
|
||||
use App\Rules\RdrFiletypes;
|
||||
// use Illuminate\View\View;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
|
|
@ -82,7 +82,7 @@ class ReviewController extends Controller
|
|||
$fieldval = $fieldValue->{$property_name};
|
||||
$value = $value . $fieldName . ": " . $fieldval . "; ";
|
||||
}
|
||||
} elseif ($fieldValue instanceof \Carbon\Carbon) {
|
||||
} elseif ($fieldValue instanceof \Illuminate\Support\Carbon) {
|
||||
$value = $value . " Year " . $fieldValue->year;
|
||||
$value = $value . " Month " . $fieldValue->month;
|
||||
$value = $value . " Day " . $fieldValue->day;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
namespace App\Library\Util;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Describes local document as a match in context of a related search query.
|
||||
|
|
|
@ -234,7 +234,7 @@ trait DatasetExtension
|
|||
if (true === empty($fieldval)) {
|
||||
$fieldval = null;
|
||||
} else {
|
||||
$fieldval = new \Carbon\Carbon($fieldval);
|
||||
$fieldval = new \Illuminate\Support\Carbon($fieldval);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ class Strategy
|
|||
|
||||
if ($value instanceof \Illuminate\Database\Eloquent\Model) {
|
||||
$this->_mapModelAttributes($value, $dom, $childNode);
|
||||
} elseif ($value instanceof \Carbon\Carbon) {
|
||||
} elseif ($value instanceof \Illuminate\Support\Carbon) {
|
||||
$this->_mapDateAttributes($value, $dom, $childNode);
|
||||
} elseif (is_array($value)) {
|
||||
$this->_mapArrayAttributes($value, $dom, $childNode);
|
||||
|
@ -181,7 +181,7 @@ class Strategy
|
|||
return $dom->createElement($fieldName);
|
||||
}
|
||||
|
||||
protected function _mapDateAttributes(\Carbon\Carbon $model, DOMDocument $dom, \DOMNode $rootNode)
|
||||
protected function _mapDateAttributes(\Illuminate\Support\Carbon $model, DOMDocument $dom, \DOMNode $rootNode)
|
||||
{
|
||||
$rootNode->setAttribute("Year", $model->year);
|
||||
$rootNode->setAttribute("Month", $model->month);
|
||||
|
|
|
@ -15,7 +15,7 @@ use App\Models\Title;
|
|||
use App\Models\User;
|
||||
use App\Models\XmlCache;
|
||||
use App\Models\DatasetIdentifier;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
// use App\Models\GeolocationBox;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Rules;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
|
@ -102,7 +103,7 @@ class RdrFilesize implements Rule
|
|||
private function getSize($attribute, $value)
|
||||
{
|
||||
if (is_numeric($value) && $hasNumeric) {
|
||||
return array_get($this->data, $attribute);
|
||||
return Arr::get($this->data, $attribute);
|
||||
} elseif (is_array($value)) {
|
||||
return count($value);
|
||||
} elseif ($value instanceof File) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Carbon\Carbon;
|
||||
// use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Carbon\Carbon;
|
||||
// use Illuminate\Support\Carbon;
|
||||
// use Database\DisableForeignKeys;
|
||||
// use Database\TruncateTable;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
// use Database\DisableForeignKeys;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Carbon;
|
||||
// use Database\DisableForeignKeys;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
{{-- <div class="form-group">
|
||||
{!! Form::label('licenses[]', 'Licenses..') !!}
|
||||
{!! Form::select('licenses[]', $options, array_pluck($document->licenses, 'id'), ['multiple' ]) !!}
|
||||
{!! Form::select('licenses[]', $options, Arr::pluck($document->licenses, 'id'), ['multiple' ]) !!}
|
||||
</div> --}}
|
||||
|
||||
<div class="pure-control-group checkboxlist">
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<td>
|
||||
{{-- @php
|
||||
$dateDiff = $dataset['server_date_modified']->addDays(14);
|
||||
$remainingDays = Carbon\Carbon::now()->diffInDays($dateDiff, false);
|
||||
$remainingDays = Illuminate\Support\Carbon::now()->diffInDays($dateDiff, false);
|
||||
@endphp --}}
|
||||
|
||||
{{ $dataset->remaining_time . ' days' }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user