laravel-routing

How to structure a modular app in Laravel 5?

房东的猫 提交于 2019-12-29 10:06:30
问题 I would like to divide my application in modules. For instance, there would be a "core" modules that contains the basic login functionality, app layout/formatting (CSS etc), user management and a diary. Later on I may create other modules like a contact manager that can easily be added or removed from the application. There would be some logic in the apps navigation for determining which modules are present and to show/hide the links to them. How can I do this in terms of directory structure,

Laravel 5.2 Missing required parameters for [Route: user.profile] [URI: user/{nickname}/profile]

安稳与你 提交于 2019-12-28 02:52:27
问题 I keep getting this error ErrorException in UrlGenerationException.php line 17: When ever any page loads and I'm logged in. Here is what my nav looks like @if(Auth::guest()) <li><a href="{{ url('/login') }}">Log In</a></li> <li><a href="{{ url('/register') }}">Sign Up</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ Auth::user()->nickname }}<span class="caret"></span></a> <ul class=

How to get a list of registered route paths in Laravel?

空扰寡人 提交于 2019-12-28 01:51:32
问题 I was hoping to find a way to create an array with the registered routes paths within Laravel 4. Essentially, I am looking to get a list something like this returned: / /login /join /password I did come across a method Route::getRoutes() which returns an object with the routes information as well as the resources but the path information is protected and I don't have direct access to the information. Is there any other way to achieve this? Perhaps a different method? 回答1: Route::getRoutes()

Laravel htaccess

微笑、不失礼 提交于 2019-12-25 10:56:13
问题 I've setup a new install of Laravel on my local. It appears there are issues with htaccess or Apache settings. I've researched for a number of hours and tried everything I read. OSX Lion 10.7.5 MAMP 3.0.5 PHP 5.5.10 mod_rewrite is being loaded. My development server works with other sites. This is the first time I am trying Laravel 4. I get a 403 Forbidden on the welcome page which is located at website.dev:8888/ Apache gives me this error: Directory index forbidden by Options directive Here

Laravel htaccess

烂漫一生 提交于 2019-12-25 10:55:23
问题 I've setup a new install of Laravel on my local. It appears there are issues with htaccess or Apache settings. I've researched for a number of hours and tried everything I read. OSX Lion 10.7.5 MAMP 3.0.5 PHP 5.5.10 mod_rewrite is being loaded. My development server works with other sites. This is the first time I am trying Laravel 4. I get a 403 Forbidden on the welcome page which is located at website.dev:8888/ Apache gives me this error: Directory index forbidden by Options directive Here

Hide required parameters of routes in Laravel 5.0

半腔热情 提交于 2019-12-25 07:05:25
问题 How could i hide the parameters of a get route in laravel 5? I mean, a route can have required parameters, and also optional parameters, i would like to know how to hide that parameters. Here's Laravel docs for Route parameters You can capture segments of the request URI within your route: Route::get('user/{id}', function($id) { return 'User '.$id; }); If my domain is: example.com, when i access to example.com/user/201348 i would like that in the browser the URL be: example.com/user for

Update route generates incorrect url

荒凉一梦 提交于 2019-12-25 03:58:15
问题 This is my html blade code {{ Form::open(array('route' => 'restaurants.update', 'class' => 'mainInformationContrainer')) }} <ul> <li> <label>Website</label> <div class="oneInfo"> <input type="text" value="{{$restaurant->website}}" /> </div> </li> <li> <input type="submit" value="Save Changes"/> <input type="button" value="Cancle" class="cancelButton"/> </li> </ul> {{ Form::close() }} But the url for the form is : public/restaurants/%7Brestaurants%7D Thought I already have the route: Route:

How to call a helper method from routes in Laravel

浪尽此生 提交于 2019-12-25 01:32:47
问题 Normally we called a controller method from route like below Route::get('/route_name', 'controllerName@method'); But is there any way to call a helper method from route ? 回答1: Step 1 First one is pretty easy and straightforward. Simply go to composer.json file located in your Laravel project "autoload": { "files": [ "app/Helpers/Helper.php" ], "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, After changing composer.json file and adding a new path to the

FatalErrorException in routes.php line 22: Class 'Painting' not found

淺唱寂寞╮ 提交于 2019-12-24 17:43:15
问题 I got this error when I was trying to learn Laravel migrations from a video tutorial. The tutor created a file named Painting.php in the app/models folder. The content of Painting.php is: <?php class Painting extends Eloquent{ } ?> and then in the routes.php : Route::get('/', function () { $painting = new Painting; //**this thing generates error** $painting->title='Do no wrong'; $painting->save(); return view('welcome'); }); Now , question is where I am supposed to place Painting.php file

Implicit Route Model Binding

南笙酒味 提交于 2019-12-24 08:07:42
问题 Laravel's implicit route model binding isn't working. It is not looking up the record indicated by the identifier. I'm getting a brand new model object. Given this code: Route::get('users/{user}', function (App\User $user, $id) { $user2 = $user->find($id); return [ [get_class($user), $user->exists, $user], [get_class($user2), $user2->exists], ]; }); And this URL: /users/1 I get this output: [["App\\User",false,[]],["App\\User",true]] I'm on PHP 7.2 and Laravel 5.6. Additional Information I've