コード例 #1
0
 public function store(Request $request, $resourceSlug, $entityId, $objectId)
 {
     $resource = $this->resourceRepository->getBySlug($resourceSlug);
     $entity = $this->entityRepository->getById($entityId, $resource);
     $object = Object::find($objectId);
     $entity->objects()->attach($object->id, ['label' => $request->label, 'ordinal' => 100, 'data' => serialize($request->only(['data']))]);
     return redirect('admin/' . $resource->slug . '/' . $entity->id);
 }
コード例 #2
0
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Model::unguard();
     Object::create(['title' => 'Text', 'slug' => 'text', 'description' => 'Basic text field']);
     Object::create(['title' => 'WYSIWYG', 'slug' => 'wysiwyg', 'description' => 'Full editor']);
     Object::create(['title' => 'Photo Gallery', 'slug' => 'photo_gallery', 'description' => 'Capture photos for the use in a gallery, slider, etc.']);
     Object::create(['title' => 'Embed', 'slug' => 'embed', 'description' => 'Embed something...']);
     Model::reguard();
 }
コード例 #3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $entity = $this->entityRepository->getById($id, $this->resource);
     return view('laramanager::resource.show')->with('resource', $this->resource)->with('entity', $entity)->with('objects', Object::all());
 }