21 Beiträge

Eloquent: Return Default Relation

Zum Beispiel: jeder User hat Rollen zugeordnet (unter Verwendung von Confide): For example: each User has a Role (using Confide): public function roles() { return $this->belongsToMany('Role', 'assigned_roles', 'user_id', 'role_id'); } Wenn keine Rolle definiert ist, wie kann man trotzdem eine Default-Rolle zurück geben? If no role is defined, how could […]

PHPstorm: Einrichten eines neuen Projekts mit ide-helper

Zunächst ein neues Projekt auf der Basis von composer erzeugen. Das Weitere nach barryvdh: Require this package with composer using the following command: composer require barryvdh/laravel-ide-helper After updating composer, add the ServiceProvider to the providers array in app/config/app.php ‘Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider’, You can now re-generate the docs yourself (for future updates) in […]

Set A DevExpress RepositoryItemLookupEditor to Display Text From A Referenced Table

That’s what a LookupEditor is intended for: display text from another table that is referenced by an external key. public RepositoryItemLookUpEdit GetRepositoryEditorLookup(T element) { var rep = new RepositoryItemLookUpEdit(); rep.BeginInit(); if (_entities == null) { return null; } var set = _entities.CreateObjectSet<T>(); // create the list of objects of type […]