Comments (4)
I think L4 way is much more cleaner, and allows you to organize your app in a cleaner way, yes in L3 you could do 'auth@login', but you memorize that the first parameter is the Controller, in the L4 version you don't need to memorize anything, you just need to read and identify where is the controller and where is method.
I think L4 approach, to be more meaningful is good, you may write a little bit more of code, but you can read it as it was english.
Maybe they'll change it to L3 Routes, but i really doubt that.
from framework.
Much prefer L4's way of specifying controllers to respond a route. There is no convention anymore (which I'm stoked about) for naming of, well, any class in L4. This leads to huge flexibility.
If you require your app to have this logic, you could create a package and put it up on composer or you could simply edit a couple of files to manipulate the core to behave like you'd want. You could also do something like:
<?php
// in start.php
$app['router'] = $app->share(function($app) { return new MyCustomRouter($app) });
// in MyCustomRouter.php
class MyCustomRouter extends Illuminate\Routing\Router {
protected function createControllerCallback($attribute)
{
list($controllerAlias, $method) = explode('@', $attribute);
$actualController = ucfirst($controllerAlias).'Controller';
return parent::createControllerCallback($actualController.'@'.$method);
}
}
And vòila, you've got your app-specific controller assumptions and logic.
from framework.
I think I forgot to dump-autoload after renaming. Foo.PHP and classname Foo works fine.
However, a note to others, perhaps keeping Controller in the name is better. Yes, generating an URL isn't as clean (FooController@index) however, when you've lots of files open, it's a lot easier to know which tab is your controller! ;)
from framework.
In L4 you can actually name things any way you like as it isn't mapped that way, it uses composers autoloader which will map a file path to whatever class is used. So you could name your file snake_case_name.php
and then the controller RandomController_Name
and it would still work fine.
from framework.
Related Issues (20)
- Migrations not respecting nullable on polygon or point types. HOT 8
- Redis interactions silently fail if using the same connection as a currently subscribed client HOT 1
- Unexpected DateTime Format in assertDatabaseHas Method with Date HOT 1
- Incorrect information in the comment block for the function Str::orderedUuid() HOT 1
- Different getPrefix() behavior for cached and non-cached routes HOT 7
- SQLite `whereJsonContains` grammar not working correctly HOT 8
- Max file size rule is lost if `types` used after HOT 2
- Null exception when sending a mail defining envelope without `from` HOT 3
- eloquent created event fired too early HOT 1
- Eloquent's `ArrayObject` breaks default behavior of json encoding HOT 1
- Docs Command can not be cancelled when offline HOT 6
- New Observe Attribute work has broken my model HOT 2
- whereHas, withWhereHas doesn't work properly with "withAvg.... " methods. HOT 2
- whereHas, withWhereHas doesn't work properly with "withAvg.... " methods. HOT 4
- 'array' validation rule passes when the value is an empty string and required_array_keys passes as long as at least 1 key exists HOT 1
- Error in observe function of HasEvent trait due to model dependency handling in Laravel 10.44.0 HOT 1
- [v11] Spark middleware does not exist HOT 4
- page expired when login HOT 1
- Incorrect behaviour "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." HOT 3
- Sessions table is created even though driver is set to redis HOT 8
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 framework.