Comments (5)
Before 3.0.0 is released, I plan on allowing optional per-model action permissions. So this would work something like this:
'actions' => array(
'delete' => function() {return false},
'create' => function() {return false},
)
With the other one being "edit", I think. I'd leave "read" out because reading data for a model would be the base level of access given in the model's "permission" option.
from laravel-administrator.
Let me explain in more details what i meant originally:
I would like to use a db table in a single row model, so i can have all kinds of nice Fields together - but i only need one row. It comes handy when i want to create a "Website's general settings" sort of menu in administrator alongside the real table models.
So a "hack" would look something like this, after selecting menu:
- No need of table list, because we use only one row
- No need of create button, because we wanna keep using one row
- No need of Filter box at all
- Need of a nicely expanded Edit box (maybe full screen), showing the fields of the only table's row (for simplicity can use id=1)
- No need of Delete (previous comment comes handy!), only Cancel and Save buttons in Edit box
Being able to do these steps would do the job for me, but you may consider implementing some similar "Set of Fields" model deeper in administrator - alongside the good old table model.
I could do 3. before; i love Filtering, but in tables with few lines (and also with many fields) comes handy to turn it off.
from laravel-administrator.
- is a bit tricky to handle at the moment, but I'll try to think of some ways to handle it.
- is now possible with this commit.
- is something I've been thinking about, but for now I'm keeping that out of 3.0.0. It's a problem that the filter area is still there when no filter fields are present, but doesn't break the app so I will likely put it in 3.1.0.
- This would go hand-in-hand with the first item, so I'm thinking of some way to handle this nicely.
- Also now possible due to aforementioned commit.
As you mention, there may be a smarter way of handling this without bringing up the table data at all. Thinking about it...
from laravel-administrator.
So earlier when I set up the permissions, I actually created a situation just like the one you're describing. For the moment, making create
and delete
only available to the developer effectively allows you to have a one-row settings object that a user can edit but not delete. It's a bit hacky, but it's a solution to go with until I think of something more comprehensive :)
from laravel-administrator.
Hey @andrewdworn, I just want to let you know that I've added a settings feature in a recent commit (defdea5). You can check out the docs here:
https://github.com/FrozenNode/Laravel-Administrator/blob/3.2.0/docs/settings-configuration.md
The short version is that it works very similar to the model config, except with only the edit_fields
property. All field types are allowed with the exception of key
and relationship
. Instead of taking a firm stance on how to save the data (whether it be by writing to a PHP file, JSON file, or to any combination of SQL tables/rows), I decided to let the system be agnostic about how the developer wants to use the data. For UI purposes, I just store the form data in storage/administrator_settings
as a JSON file, but the developer has a beforeSave
callback that they can use to manipulate the form data and/or store it however they like. I spent most of yesterday thinking about the best way to approach that problem, but stil the idea is only about a day old. If you have any ideas/suggestion/criticisms, please do let me know.
from laravel-administrator.
Related Issues (20)
- how to upload mp3 file and get its duration in laravel 4.2 HOT 1
- add persian (farsi) language
- Domain HOT 3
- WYSIWYG: disable remove class
- Laravel 5.3 Mysql Strict Compatibly Issue HOT 2
- Frozennode.com HOT 10
- edit_fields in type "relationship" doesn't work when foreign key is a non-primary key.
- Response::download not work in global action HOT 1
- error "MethodNotAllowedHttpException in RouteCollection.php line 218:" on laravel 5.3
- Add field type "array"
- How to change column value depending on selection of other field using relationship field
- Trying to change the value of uri in administartor.php returns InvalidArgumentException in UrlGenerator.php line 307: Route [admin_dashboard] not defined. HOT 2
- documentation HOT 1
- Laravel 5.4 support HOT 6
- File Download Dialog does not trigger in Chrome 57 HOT 4
- Master / Child form
- Pulling out of this project HOT 1
- can't register provider in config/app.php
- ERROR: Function name must be a string
- PHP 7.2.4 sizeof(): Parameter must be an array or an object that implements Countable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-administrator.