public function scopeCost($query,$value)
{
return $query->where('cost', '>', $value);
}
$data = Order::cost(100)->get();
axios.post('/api/test', {myfiles: [{generatedName:'test',originalName:''},{originalName:'test2'}], article_id:1})
$request->validate([
'article_id' => 'required',
'myfiles.*.generatedName' => 'required|string|max:255',
'myfiles.*.originalName' => 'required|string|max:255',
]);
{"message":"The given data was invalid.","errors":{"myfiles.1.generatedName":["The myfiles.1.generatedName field is required."],"myfiles.0.originalName":["The myfiles.0.originalName field is required."]}}
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function __construct()
{
$this->middleware(function ($request, $next) {
return $next($request);
});
}
}
<meta name="csrf-token" content="{{ csrf_token() }}">
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
{!! Form::select('subscribe_id', array(0 => 'Выберите тип подписки', '5' => 'Демо-доступ', '6' => 'Доступ на 1 месяц 1500 руб.', '7' => 'Доступ на 3 месяца 3600 руб.','8' => 'Доступ на 1 год 12600 руб.'),null,['class' => 'custom-class'])!!}
$latest выдает null
optional($latest)->date
$last = Carbon::createFromTimestamp($latest->date)->toDateTimeString();//477 stroka
в Tournaments
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'created_at',
'updated_at',
'date'
];
$categories = Category::select(DB::raw('categories.*, count(*) as `aggregate`'))
->join('pictures', 'categories.id', '=', 'pictures.category_id')
->groupBy('category_id')
->orderBy('aggregate', 'desc')
->paginate(10);