/** * Relate all items in this collection to the given model. * @param $model string|Model * @return bool|null */ public function attach($model) { if (is_string($model)) { $model = Model::str($model); } if (!$model) { return null; } foreach ($this->items as $media) { $model->relate($media); } return true; }
/** * Displays the media selection tool dialog. * GET /media/list?parent=Birdmin\Page\1 * @param Request $request * @return \Illuminate\Http\Response */ public function select(Request $request) { $media = Media::request($request, $this->user, 30); $parent = Model::str($request->input('parent')); return view('cms::media.select', compact('media', 'parent')); }