laravel-routing

Is it possible to reorder or ignore parameters in controller routes?

家住魔仙堡 提交于 2019-12-08 08:19:15
问题 The question title is the most explicit I could think of, but here's a use case/example for clarity's sake: Say I define the following route to show an article: Route::get('article/{slug}/{id}', 'ArticleController@show'); ... class ArticleController extends BaseController { public function show($id) { return View::make('article')->with('article', Article::find($id)); } } This won't work, as show will misake the $id parameter with the $slug parameter. Is there a way to pass only the $id

Laravel Route failing: Receiving PHP Fatal error: Class 'Route' not found in routes.php on line 14

断了今生、忘了曾经 提交于 2019-12-08 08:10:13
问题 I am getting the following error when trying to display my site: PHP Fatal error: Class 'Route' not found in /home/jillumin/public_html/muse/app/routes.php on line 14 Route looks like the following: Route::resource('ideas','IdeaController'); The controller is here: class Idea_Controller extends BaseController { /** * Display a listing of the resource. * * @return Response */ public function index() { //get all the ideas $ideas = idea::all(); // load the view and pass the ideas return View:

Laravel4 route pattern error

筅森魡賤 提交于 2019-12-08 07:24:27
问题 I´m using laravel 4 for a cms project, and i´m having some problems with my routes... These are my current routes Route::get('/', 'IndexController@showNews'); Route::get('/logout', 'UserController@logout'); Route::resource('/login', 'UserController'); Route::resource('/user', 'UserController@index'); Route::resource('/user/{route}', 'UserController'); // Routes that shows us the pages... Route::get('/{page}', 'IndexController@showPage'); Route::get('/{page}/{id}', 'IndexController@showPage');

Laravel - Change Database Connection for a specific URL?

∥☆過路亽.° 提交于 2019-12-08 06:13:27
问题 I am fairly new to using laravel framework. I have the following requirement. I have a domain - example.com, and its entire code stack is running in laravel. Lets say in the config default database connection is - 'db1' Now, if the url becomes - example.com/country - I want the default database connection to become - 'db2' And also I want the base URL to be changed to example.com/country, since all the modules are going to be the same. Only the database connection is going to change here.

Laravel - Change Database Connection for a specific URL?

隐身守侯 提交于 2019-12-08 05:48:28
I am fairly new to using laravel framework. I have the following requirement. I have a domain - example.com, and its entire code stack is running in laravel. Lets say in the config default database connection is - 'db1' Now, if the url becomes - example.com/country - I want the default database connection to become - 'db2' And also I want the base URL to be changed to example.com/country, since all the modules are going to be the same. Only the database connection is going to change here. Could someone help me out here? I would do it the following way: Put the list of allowed countries into

Laravel 5 Password Reset with Angular View

☆樱花仙子☆ 提交于 2019-12-08 03:02:03
问题 I am trying to use the Laravel inbuilt password reset in my app where Laravel 5.1 acts as the backend api and Angular 1.3 for all front-end views. I have set-up the Password reset as per the docs where I have done the following: 1) Create the table php artisan migrate 2) Added this to the route: Route::post('password/email', 'Auth/PasswordController@postEmail'); Route::post('password/reset', 'Auth/PasswordController@postReset'); Since I will be using Angular to display frontend forms, I did

Laravel Custom Auth

感情迁移 提交于 2019-12-07 19:46:07
问题 Here i do the Login Validation $LoginData = Input::except(array('_token')) ; if(Auth::attempt($LoginData)) { return 'success'; } My Table is different so, here i change the table name in auth.php 'table' => 'administrators' But I have the dropdown to choose for the usertype. So how can i choose the tables for Authentication according to the usertypeinput. i.e., Table may be administrators or parents or employees 回答1: I don't know whether Laravel supports the change of auth table name on fly

Make session expiration redirect back to login?

匆匆过客 提交于 2019-12-07 16:33:00
问题 When user logs in and is authenticated, I use Auth::user()->username; to show username of user on dashboard. However, for some reason when session expires the class Auth doesn't seem to work and dashboard page throws error as trying to get property of non-object for Auth::user()->username; . How can I redirect the user back to the login page when he clicks any link or refreshes the page after the session has expired? I tried the Authenticate.php middleware but it always redirects back to

Programmatically add exception from CSRF check from Laravel package

China☆狼群 提交于 2019-12-07 15:41:28
问题 The Problem in a Nutshell I'm looking for a way to remove VerifyCsrfToken from the global middleware pipeline from within a package without the user having to modify App\Http\Middleware\VerifyCsrfToken . Is this possible? The Use Case I'm developing a package that would make it easy to securely add push-to-deploy functionality to any Laravel project. I'm starting with Github. Github uses webhooks to notify 3rd party apps about events, such as pushes or releases. In other words, I would

How can I delete a post resource in laravel 5?

你。 提交于 2019-12-07 08:30:57
问题 Laravel 5 version I am working on a project with the new laravel 5 release and for some reason i cannot delete a post, when I press delete it just redirects me to the post show page with the id such as /post/3 and I get a blank white page, when I go back to index view I get all the posts and that one has not been deleted. Here is what I have below: Posts migration file use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreatePostsTable extends