Commit 86dfd060 authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #399 from moebrowne/media/feature/unique-folder-names

Media Unique Folder Names Validation
parents f881698e d4081d17
......@@ -3,13 +3,21 @@
namespace Modules\Media\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CreateFolderRequest extends FormRequest
{
public function rules()
{
$parentID = $this->get('parent_id');
return [
'name' => 'required',
'name' => [
'required',
Rule::unique('media__files', 'filename')->where(function ($query) use ($parentID) {
return $query->where('is_folder', 1)->where('folder_id', $parentID);
}),
],
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment