Comments (7)
I agree and you beat me to creating an issue for it!
If I get time this week I might make a PR
from novapackages.
I agree and you beat me to creating an issue for it!
from novapackages.
@marcusmoore If you could point me to the file where its best to trim the names ill submit a pr.
from novapackages.
It looks like the replacement is happening in the templates.
I would like to move that code to a presenter method of some sort so we can have a place to put future replacements and write tests around it.
It would be great if you're up for working on it but no pressure (of course 😄 )
from novapackages.
It looks like the replacement is happening in the templates.
I would like to move that code to a presenter method of some sort so we can have a place to put future replacements and write tests around it.
It would be great if you're up for working on it but no pressure (of course 😄 )
I'll see what I can do!
Just a thought, what if we just make a custom validation rule for name field, that way we don't even save the 'unnecessary data' to db and the user will be displayed an error, which we can tell them to use composer versions to specify support. That would also keep it in one place so we don't duplicate code.
from novapackages.
Thanks and no rush @RhysLees 😄
I don't know if I want to reject a package that includes the version in the title but I think we should be more clear about how we determine v4 support. I opened an issue to track that here: #218
from novapackages.
Thanks and no rush @RhysLees 😄
I don't know if I want to reject a package that includes the version in the title but I think we should be more clear about how we determine v4 support. I opened an issue to track that here: #218
Ah ok, i was going to recommend the following as a rule. would allow is to return feedback to the user when they create the form. This can also be used with a tiny modification to take it out of the array:
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
/**
* Any item in the haystack that doesn't contain a string needs to be placed at the bottom
* otherwise it will leave the string before the version number.
*/
$invalidSubstrings = [
'N!',
'V!',
'Nova !',
'Nova!',
'(!)', // Place at bottom
'!', // Place at bottom
];
// The haystack used to check if the string contains any of the invalid substrings.
$versionHaystack = [];
// Create the version haystack for each version of Laravel Nova.
$v = 1;
while ($v <= config('novapackages.nova.latest_major_version')) {
foreach ($invalidSubstrings as $subject) {
// Replace ! with the version number.
$versionHaystack[] = str_replace('!', $v, $subject);
}
$v++;
}
// Filter the value to only contain strings that contain the version number case insensitive.
$filteredVersions = str_ireplace($versionHaystack, '', $value);
// Filter extra spaces created by the removing elements from the version haystack.
$filtered = preg_replace('!\s+!', ' ', $filteredVersions);
return $filtered === $value;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return 'The :attribute must not reference a Laravel Nova version. Require the version in your "composer.json".';
}
from novapackages.
Related Issues (20)
- Upgrade to livewire 2
- Improve handling of Github errors
- Update the package `repo_url` field when it has changed
- Improve handling of `UserRatePackage` job HOT 1
- Catch `SelfAuthoredRatingException` and return an error HOT 1
- Updating to Laravel 8 broke the RSS feed
- Package Author is broken/empty - Broken json<->select mapping HOT 1
- Show support for Nova version 3 or 4 HOT 11
- Screenshots not saving HOT 7
- More API data [enhancement] HOT 5
- Explain how Nova v4 support is determined HOT 1
- Add pagination to admin index page
- JSON feed of packages HOT 1
- Feature to allow report of packages that just copy another package code. HOT 4
- Allow packages with malicious code to be reported
- How to highlight package for Nova 4 HOT 7
- Package dublicate
- Unable to upload audio files HOT 1
- Packagist returning a result with no `package` key which we don't handle well HOT 3
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 novapackages.