FAQ Database Discussion Community


Whoops! There was an error. NotFoundHttpException

laravel,laravel-4,laravel-routing
I can see that Laravel is not able to get resources when the resource name includes a plus sign (+) Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException GET http://localhost:8000/vendor/store/store+json2.min.js 404 (Not Found) GET http://localhost:8000/vendor/animo/animate+animo.css 404 (Not Found) REQUEST_URI /vendor/store/store+json2.min.js REQUEST_METHOD GET SCRIPT_NAME /vendor/store/store json2.min.js REQUEST_URI /vendor/animo/animate+animo.css REQUEST_METHOD GET...

Multi-lingual site in Laravel 5

php,laravel,laravel-5,laravel-routing
I started using the framework for php: Laravel 5. I'm trying to implement in my website a possibility to translate to different languages. I just recently started learning how to code using this website and it's kind of complicated because there's not enought information in the internet. Does anybody can...

Manually calling controller method with parameter and still have method injection

laravel,laravel-5,ioc-container,laravel-routing
How can I call a controller method manually specifying some input parameters yet still have method injection work for the parameters not specified (example below). routes.php $myController->index($id); controllers/MyControllerOne.php class MyControllerOne { public function index($id, MyRequest $request) { } } extra information The reason I need this is because I have...

Keep form values when redirect back in Laravel 4

forms,redirect,laravel,laravel-4,laravel-routing
I'm trying to keep the values of a form when Redirect::back on Laravel 4, but I can't find a way to do this. This is my form: {{ Form::open(array('route' => 'generate', 'files' => true)) }} {{ Form::radio('myType', '1', true); }} {{ Form::label('myType', '1'); }} {{ Form::radio('myType', '2'); }} {{ Form::label('myType',...

Redirect in Route Service Provider

php,redirect,laravel,laravel-routing,laravel-5
I'm currently using the route/model binding to check if there is a valid id for a Tag in my database. It's pretty sweet so far but I would like to make sure that: If there is no slug set it should redirect to the slugged url Make sure the slug...

Restrict route access to non-admin users

php,laravel,laravel-5,laravel-routing,laravel-middleware
Goal I'm trying to create Admin route restriction for my log-in users. I've tried a check to see if my user is log-in, and also if the user type is Admin, and if they are, I want to allow them access to the admin route, otherwise, respond a 404. routes.php...

Blank page after Redirect::to() in Laravel 4.2

laravel,laravel-4,laravel-routing
I read a lot about the Blank Page after Redirect::to() in Laravel 4.2. Here is my controller function: public function profile($salon_id){ $salon_profile = $this->mSalon->getSalon($salon_id); if(Session::get("user_type.dist_content_filter") && Session::get("user.distributor_id")!=$salon_profile["distributor_id"]){ return Redirect::to('error/401'); } $lstDistributors = $this->mDistributor->getDistributors(array()); $lstCountries = (new Countries)->getCountries(); View::share('lstCountries', $lstCountries);...

Route using either a prefix or a domain

laravel,laravel-routing,laravel-5
I am working on a platform that allows users to run their own site in either a sub folder of the main website domain, or map a custom domain for their site. When using a custom domain the URL structure for each route is slightly different in that it is...

Laravel Routing URLs not working except for default URI

php,.htaccess,laravel,laravel-routing,laravel-5
I have set up Laravel 5 for the first time on my localhost. I am able to load the default URL but not any others. In other words, this works: localhost/laravel/siteName/public/ but not localhost/laravel/siteName/home/ or localhost/laravel/siteName/public/home/. I have not changed any default values in routes.php or in .htaccess. I did...

How to protect querystring or parameters passed to another page

php,laravel-4,laravel-routing
I have a scenario which displays list of products in a tabular format and one of the column has a link to the product page. <td> <a href="/ViewProduct/{{$request->prd_ID}}/{{$request->usr_ID}}" id="link" > Product </a> </td> The route is as follows: Route::get('ViewProduct/{pid?}/{uid?}', '[email protected]_Load'); and the URL would be: http://example.com/ViewProduct/11/4 This approach directly exposes...

How to change password reset messages in laravel 5?

laravel,laravel-routing,laravel-5
How to change laravel's "The email field is required." on password reset page to my custom message? Cant find rules and messages for it

Actually I am learning Laravel I need some Advance lavel resource. any body can help me [closed]

laravel,laravel-4,laravel-routing,laravel-3
Actually I am learning Laravel I need some Advance level resource. any body can help me .I complete beginner level .

Laravel 5 link does not work properly

php,laravel,url-routing,laravel-5,laravel-routing
I am new to Laravel 5 Framework and I have a link as <a href="http://localhost:8080/AutoQlik/public/pages/aracislemler/?page=2">2</a> and its route is already defined as Route::get('/pages/aracislemler', '[email protected]'); but when i click it, it goes to http://localhost:8080/pages/aracislemler?page=2 What might cause to this problem ? Any help would be appreciated....

How to send data/variable from one method to another in the same controller in laravel 5?

php,laravel,laravel-4,laravel-routing,laravel-5
I have 2 functions/methods in the same controller in Laravel like this.. <?php namespace App\Http\Controllers; use App\Http\Requests; //use App\Http\Requests\CreatRole; use App\Http\Controllers\Controller; use Input; use Redirect; use Illuminate\Http\Request; use App\UserRole; class UserController extends Controller { /** * Remove the specified resource from storage. * * @param int $id * @return Response...

Laravel 5 Function () not found

php,laravel,middleware,laravel-routing,laravel-5
I'm putting together a site which has a protected section where users must be logged in to access. I've done this in Laravel 4 without too much incident. However, for the life of me I cannot figure out why I can't get it to work in Laravel 5(L5). In L5...

BASE URL Routing not working as intended

laravel,wampserver,laravel-5,laravel-routing
I'm reasonably new to Laravel, I've worked with Laravel 4 but decided to use the fancy new Laravel 5 for a personal project and to really learn it. I thought of posting this over at Webmasters.SE but couldn't find any other questions regarding Laravel. I couldn't find any solutions on...

Working with Laravel routes

laravel,laravel-5,laravel-routing
i built my application using angularjs on the frontend and laraveel-5 at the backend, however my main issue now is routing, when the page is loaded initially i set it to return my angular.php view i even added some code to catch all routes and return that view for me....

'Class 'App\Http\Controllers\Url' not found' — Laravel 5

php,laravel-5,laravel-routing
I have started learning Laravel 5. Following this tutorial. I am getting this error. (Class 'App\Http\Controllers\Url' not found). I have attached the image of my code here. Whoops, looks like something went wrong. 1/1 FatalErrorException in UrlController.php line 22: Class 'App\Http\Controllers\Url' not found in UrlController.php line 22 at FatalErrorException->__construct() in...

Redirect subfolder to Wordpress without showing URL

php,wordpress,redirect,laravel,laravel-routing
I have a PHP Laravel application hosted at xyx.com. Now I am setting up a blog for my application at xyz.com/blog. This blog I want to host at Wordpress.com so that my blog is managed by Wordpress for me. xyz.com/blog -> xyz.wordpress.com I tried to setup some redirect in the...

Laravel 5 : [Call to a member function getAction() on a non-object

laravel,laravel-5,laravel-routing
In my Controller, I have Route::getCurrentRoute()->getAction()['as'] Everything works well in the browser but as soon as I type php artisan route:list in the terminal I have this exception [Symfony\Component\Debug\Exception\FatalErrorException] Call to a member function getAction() on a non-object If I comment this line everything works well....

Laravel Controller Delegation

laravel,laravel-4,laravel-routing
Trying to keep my Laravel 4.2 project organized here, while letting it grow. Currently I use: Route::controller('/admin', 'AdminController'); ...in order to allow the controller to service general admin pages. This is working fine, however I'd like to delegate specific subqueries to other controllers for cleanliness reasons. For example, I'd like...

How to avoid Reflection Exception in Laravel's project and what are the causes which produce it?

php,laravel,laravel-5,laravel-routing
I have made a project named my-school using Laravel. Everything works fine, except when I run my project using XAMPP. I'm then using this url: localhost/my-school/public/. Here's the raised exception: Fatal error: Uncaught exception 'ReflectionException' with message 'Class MySchool\Http\Kernel does not exist' in E:\xampp\htdocs\my-school\vendor\laravel\framework\src\Illuminate\Container\Container.php:776 Stack trace: #0 E:\xampp\htdocs\my-school\vendor\laravel\framework\src\Illuminate\Container\Container.php(776):...

Laravel: Missing argument 1 for AdminController::getUpdateUser()

laravel,laravel-4,laravel-routing
I'm new to larevel and i've been trying to solve this problem starting yesterday up to now and haven't make any progress and im stuck here.... PLEASE HELP :( Here's my code for the routes: Route::get('/admin/edit', array('uses' => '[email protected]', 'as' => 'getUpdateUser')); Route::resource('admin1', 'AdminController'); Here's my code for the button...

Laravel - Path of page from which request was made

laravel-5,laravel-routing,laravel-request
How can I determine the path of the page from which the request was made? I have tried $request->path() or Request::path() but these two return the path on which request is going.. ...

Redirect to Login if user not logged in Laravel

laravel,laravel-4,laravel-routing
i am new to laravel, i have code in my controller's __construct like if(Auth::check()) { return View::make('view_page'); } return Redirect::route('login')->withInput()->with('errmessage', 'Please Login to access restricted area.'); its working fine, but what i wants is. its really annoying to put these coding in each and every controller, so i wish to...

Routing in laravel 5 with resource

php,laravel-5,laravel-routing
I've a route: Route::resource('partner/register', 'PartnerController\Register'); And function index, works. But when I try route to store with: {!! Form::open(['route'=>'partner/register.store']) !!} Error: Route [partner/register.store] not defined. Why? help please. PD: I used artisan make:controller PartnerController/Register to create the controller. Because need of create controllers in differents directories...

Laravel URLs with query parameters

laravel,url-routing,laravel-routing,laravel-5
I want to implement a link in my application, but instead of it following this format: /origin/{number} I want it to look like this: /origin=number How do I implement a route successfully which will understand this link format? Surely Laravel is flexible enough to not only be able to parse...

Laravel 5 - before auth not working

php,laravel,laravel-5,laravel-routing
Today I tried to make some changes to my application. I tried to pass all pages through authentication first. I tried one of the answer on this site. But that didn't help. Please help. Here's my code in routes.php <?php Route::get('/', function(){ return view('homepage'); }); Route::controllers([ 'auth' => 'Auth\AuthController', 'password'...

Laravel 5 redirect after store

php,laravel,redirect,laravel-5,laravel-routing
How to redirect a route after store process at L5 ? My route is Route::get('/pages/aracislemler/{id}', ['middleware' => ['roles'], 'uses' => '[email protected]', 'roles' => ['Admin']]); And controller function public function store() { $brand_name = Request::get('brand_id'); $type_id = Request::get('type_id'); //$client_id = Request::get('representive_client_id'); if (!Brand::find($brand_name)) { $brand = new Brand; $brand -> brand_name...

Ignore a route for access checking in Laravel 5 using Entrust Package

php,laravel,laravel-5,laravel-routing
I'm using Entrust Laravel Package and it is working fine but there's a problem. I want to show a login form to admin using the below controller Route::get('/admin/login', array('as' => 'admin_login', 'uses' => 'Admin\[email protected]')); How do I tell Entrust to 'disable' access control for some routes like "admin/login"? Entrust::routeNeedsRole('admin/*', 'owner',dd(...

Laravel 5 HTTP/Requests - pass url parameter to the rules() method

laravel-routing,laravel-5,laravel-request
I'm trying to create a set of rules under the new \HTTP\Requests\UpdateArticle class for the slug field, which needs to have unique filter applied, but only when the id is not equal the url parameter of the route name article/{article}. What I got so far is: public function rules() {...

Loading partial html template into Angular app using Laravel

angularjs,rest,laravel,laravel-routing
I'm trying to use the RouteProvider functionality in Angular. A different partial html template should be loaded depending on whether the user is editing a form, viewing a list of completed entries, etc. I've been unable to load the html templates within the same page. Instead, the user is redirected...

I am trying to create a basic API in Laravel but not able to save or delete any data through it

php,laravel,laravel-5,laravel-routing
I am a complete beginner for Laravel so I am not sure I am doing this right but have been struggling with this all day. Below is my code: Controller: <?php namespace virtualine\Http\Controllers; use View; use Form; use Response; use virtualine\Post; use virtualine\Comment; use virtualine\Http\Requests; use virtualine\Http\Controllers\Controller; use Illuminate\Http\Request; class...

Laravel 5 - Routes and variable parameters in controllers

php,laravel,laravel-5,laravel-routing
I want to generate SEO friendly URLs like this when searching: http://www.example.com/search (no filters) http://**www.example.com/search/region-filter http://**www.example.com/search/region-filter/city-filter And to paginate them in this way: http://www.example.com/search/2 (no filters, page 2) http://**www.example.com/search/region-filter/2 http://**www.example.com/search/region-filter/city-filter/2 (sorry I can't post more than 2 links because of reputation) So the second segment can be a filter or...

How not to overload main routes with package routes?

php,laravel,laravel-4,laravel-routing
Main App Routes: Route::get('/login', [ 'as' => 'user.login', 'uses' => '[email protected]' ]; Route::get('/logout', [ 'as' => 'user.logout', 'uses' => '[email protected]' ]; Route::get('/admin', [ 'as' => 'admin.index', 'uses' => '[email protected]' ]; I have a package (vendor) (example : metrakit/mypackage) with a routes.php file. In this file I have a route :...

How to create a filter for a domain in Laravel

laravel,laravel-4,laravel-routing
I am trying to create a filter that works for a specific domain and redirects a user from any page they try to visit if they have gone over a quota. So far, the code does not redirect at all. Here is what I have so far in filters.php: Route::filter('domain',...

Laravel 5 Auth for Restful Resource Controllers to restrict resource to logged in user

authentication,laravel-5,laravel-routing
I have a pretty basic RESTful address manager. I have user accounts setup with user login all based on Auth and am in the process of integrating entrust but that's beyond the scope of this. For now, I simply want to restrict access to my AddressController to users who are...

Laravel 4 Namespaces routes and namespaces in controllers

php,laravel,laravel-4,laravel-routing
I was trying to order my controllers in Laravel 4 and adding them some nice namespaces So i wanted routes like this admin/scholar-groups And i wanted the controller to be in a subfolder called 'admin' So I have a route file like this: //Admin Routes Route::group(array('namespace' => 'admin'), function() {...

Lumen (Laravel) routing not passing route parameter to controller

laravel-5,laravel-routing,lumen
I'm having some trouble with Lumen's routing. I'm trying to capture the uri using regex in a route. When I try to pass the captured data to a controller method, the variable is empty, yet when I do the same using a closure, the variable shows as expected. Here's the...

Passing a param containing a path to a controller

laravel,laravel-4,routes,parameter-passing,laravel-routing
I'm trying to pass a variable who contains a path from a form to a controller function in Laravel 4, for then download an image. I tryed a lot of things, but don't works for me. If I doesn't pass the parameter in the route, obviously I get a missing...

Laravel 5 assigning middleware to all sub urls

php,laravel,laravel-routing
I am using middleware to check for admin when trying to access the admin by page by redirecting to 'auth/login' Route::get('admin', [ 'uses' => '[email protected]', 'middleware' => 'admin' ]); However I have some more pages within admin that will also require the same middleware... e.g. Route::get('admin/profiles', [ 'middleware' => 'admin',...

Redirect to Login page if ther user not logged in Laravel

laravel,laravel-5,laravel-routing
I am using Laravel version 5. I have a route file for my project which contains plenty of lines. I need to put authentication like Redirect to login page if the user is not logged in. And I also want to prevent direct URL access if the user not logged...

Laravel 4 - Improve code to check for Authentication

php,laravel,laravel-4,laravel-routing,code-cleanup
I have a Laravel 4 application with a resource Poll // routes.php Route::resource('polls', 'PollController'); I do not want anyone to be able to list all the polls, except if the user is authenticated and if (s)he is an admin. This was my solution: // PollController.php public function index() { if...

How to create a sub- domain in laravel

php,laravel,laravel-4,laravel-routing
Hi guys I am trying to create a sub-domain in laravel. The subdomain will be something like merchant.example.com and they will be more links such as merchant.example.com/login merchant.example.com/myaccount so this is what I tired Route::get('.partner/', array( 'as' => 'partner-home', 'uses' => '[email protected]' )); but just redirect me to the main...

Laravel - can I control routes by rule?

php,laravel,laravel-5,laravel-routing
So I have a Laravel Controller (MainController.php) with the following lines: ... public function _settings_a(){ return view('_settings_a'); } public function _settings_b(){ return view('_settings_b'); } public function _settings_c(){ return view('_settings_c'); } public function _settings_d(){ return view('_settings_d'); } public function _staff_a(){ return view('_staff_a'); } public function _staff_b(){ return view('_staff_b'); } public function...

Laravel documentation filter example

php,laravel,laravel-4,routes,laravel-routing
I've started to learn Laravel framework and faced with one problem. In this section they describe basic filter usage. So, I put Route::filter('old', function() { if (Input::get('age') < 200) { return Redirect::to('home'); } }); in app/filters and Route::get('user', array('before' => 'old', function() { return 'You are over 200 years old!';...

Laravel5 OldMiddleware The page isn't redirecting properly

laravel-5,laravel-routing
I'm just taking the first look at laravel5 so with a new install I'm starting playing around (as usual :) ) php artisan make:middleware OldMiddleware <?php namespace App\Http\Middleware; use Closure; class OldMiddleware { /** * Run the request filter. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return...

Laravel 5 MethodNotAllowedHttpException

php,laravel,laravel-5,laravel-routing
I am using a form with PATCH method and I have a button link(since i already have a submit button and using same form for both store and update) as <a class="btn btn-default" href="{{ URL::to( 'pages/edit/' . $vehicle -> id) }}">EDIT</a> And my route is Route::patch('/pages/edit/{id}', ['uses' => '[email protected]']); Controller...

How to use the request route parameter in Laravel 5 form request?

php,laravel,laravel-5,laravel-routing,laravel-validation
I am new to Laravel 5 and I am trying to use the new Form Request to validate all forms in my application. Now I am stuck at a point where I need to DELETE a resource and I created a DeleteResourceRequest for just to use the authorize method. The...

Laravel 5 - redirect to HTTPS

php,laravel,laravel-routing,laravel-5
Working on my first Laravel 5 project and not sure where or how to place logic to force HTTPS on my app. The clincher here is that there are many domains pointing to the app and only two out of three use SSL (the third is a fallback domain, long...

How to setup Apache to run Laravel rooted from a subpath?

apache,.htaccess,laravel,laravel-routing,mod-alias
The DocumentRoot of example.com is in /var/www/html. Laravel is installed in /var/www/example/public and I can access it using http://example.com/dashboard but problem arises when I try to access other routes like as http://example.com/dashboard/login and is throwing 404 Not Found error. And saying The requested URL /var/www/example/public/index.php was not found on this...

Why does this Laravel5 ressource route 404?

laravel,laravel-5,laravel-routing
In the file routes.php I added the line Route::resource('tasks', 'TasksController'); and then generated TasksController using artisan php artisan make:controller TasksController. So why is localhost/blog/public/tasks returning 404?...

Laravel 5 Authentication

laravel,laravel-5,laravel-routing
I have just set up my Laravel installation and I have been reading the documentation and it appears that it ships with a authentication system built in. Which I would like to use rather than build my own ( which I have done in the previous version) My question is...

Laravel routes matching everything after prefix

laravel,laravel-4,laravel-5,laravel-routing
I'm trying to match a path in a URL something like the following My HTTP Request http://localhost/myprefix/extra/x/x/x/x/x/2/3/2/ routes.php Route::group( ['prefix' => 'myprefix'], function () { Route::get('extra/{path}', ['as' => 'myprefix.one', 'uses' => '[email protected]']); Route::get('extraOTher/{path}', ['as' => 'myprefix.two', 'uses' => '[email protected]']); } ); MyController.php public function index($path) { // $path should be...

Laravel 5 - Nest Resource index method resource ID

php,laravel,laravel-5,laravel-routing,nested-resources
I try to make a default controller base on the Laravel Restful Controller, and I'm block with the index method with Nested Resources. I have a route Route::resource('photos.comments', 'DefaultController'); and I need to get the photo_id in my index method. But so fare, I only get {photos}. public function index(Request...

Laravel 5 Routing Calling Wrong View

php,laravel,laravel-5,laravel-routing
I've got a simple Laravel 5 site that I am working on (learning Laravel) I have a link on my 'users' view to add a 'new user': <a href="{{ url('/user/create') }}">Create New User</a> My user Routes look like the following: Route::get('/users', '[email protected]'); Route::get('/user/{id}', '[email protected]'); Route::get('/user/create', '[email protected]'); Route::get('/user/update', '[email protected]'); Route::get('/user/delete/{id}', '[email protected]');...

Laravel Saving data

laravel-4,laravel-routing
In my Laravel project I use this code into controller method to save data: $countCourseTeacher++; $routine->p1=Input::get('course_teacher' . $countCourseTeacher); $routine->p2=Input::get('course_teacher' . $countCourseTeacher); $routine->p3=Input::get('course_teacher' . $countCourseTeacher); But I want to use $routine->p$i into a for loop Like for ($i=1; $i <=6; $i++) { $countCourseTeacher++; $routine->p$i=Input::get('course_teacher' . $countCourseTeacher); } When I use $routine->p$i...

405 Error when trying to send email via route with Laravel

php,email,laravel,laravel-4,laravel-routing
Trying to send an email using Laravel but keep getting a 405 error and the whoops page showing: * @param array $others * @return void * * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException */ protected function methodNotAllowed(array $others) { throw new MethodNotAllowedHttpException($others); } The code is: {{ Form::open(array('url' => 'admin/newemail')) }} // form items...

LARAVEL use single form for both Edit and Insert actions

php,laravel,laravel-4,laravel-routing
in my application i want to simplify forms and change Form::model to use both of Update and Insert, for have this ability i'm create this route:controller to show View and modrate it: Route::controller( 'customers' , 'customersController', array( 'getIndex' =>'customers.index', 'postUpdate'=>'customers.update' ) ); customersController controller class: <?php class customersController extends \BaseController...

Set session variable in laravel

php,laravel,session-variables,laravel-routing,application-variables
I would like to set a variable in the session using laravel this way Session::set('variableName')=$value; but the problem is that I don't know where to put this code, 'cause I would like to set it for one time (when the guest visite the home page or any other page)? The...

Laravel Custom Route Model Binding

php,laravel-5,laravel-routing
I have the following setup: routes.php Route::get('{page?}', [ 'uses'=>'[email protected]', 'as'=>'page' ])->where('page', '(.*)?'); RouteServiceProvider.php $router->bind('page', function($value, $route) { if($value == "/"){ $value = "home"; }; $explodedPage = explode("/",$value); $page = Page::findBySlug(last($explodedPage)); if(!isset($page)){ \App::abort(404); } $ancestors = $page->ancestorsAndSelf()->get(); $sections=array(); foreach($ancestors as $ancestor) { $sections[]=$ancestor->slug; }...

Laravel-5 Redirect Loop [SOLVED]

php,laravel,redirect,laravel-5,laravel-routing
My routes.php like this: Route::get('deneme/{test}', '[email protected]'); Route::get('send', '[email protected]'); Route::get('elfinder/tinymce4', 'Barryvdh\Elfinder\[email protected]'); Route::group(['middleware' => ['auth', 'perm'], 'prefix' => 'admin'], function(){ Route::get('/', ['as' => 'admin', 'uses' => 'Admin\[email protected]']); Route::resource('kategori', 'Admin\KategoriController'); Route::resource('icerik', 'Admin\ContentController'); // Property Routes...

Query String Preservation in Laravel

laravel,laravel-5,laravel-routing
I am newbie of Laravel, PHP and web development. I have two tabs Teachers <a href='/teachers'>Teachers</a> and Courses <a href='/courses'>Courses</a> and two drop-downs i.e. Category, City in header navigation. Teachers and Courses tabs take me to their respective pages localhost/teachers and localhost/courses. Category and City add query strings as follows...

Laravel 5 making a route for a specific link

laravel,laravel-5,laravel-routing
I have a link that goes to a address like http://localhost/pages/vehicles?show=61 Is it possible to make a route for that kind of link i tired below route but it does not work Route::get('/pages/vehicles?show={id}', ['middleware' => ['roles'], 'uses' => '[email protected]', 'roles' => ['Admin']]); ...

Laravel and PSR 4 Autoloading not working

php,laravel,laravel-routing,laravel-5
I've just set up a new Laravel 5 project. I included a Helpers.php in the /app directory. Here it is: <?php namespace EP\Helpers; class Helpers { public static function sayHi() { return 'Hi'; } } And in the route I am doing: Route::get('/', function(){ return EP\Helpers\Helpers::sayHi(); }); But when I...

simple Laravel View::make() not working

php,laravel,laravel-routing
So I'm learning some basic Laravel stuff as I am new to PHP. I am following a basic tutorial that is having me print stuff to a file named home.blade.php. The way I am calling it now is as follows. Here is my routes.php Route::get('/', array( 'as' => 'home', 'uses'...

Passing parameter to controller via Route::controller

php,laravel,laravel-4,laravel-routing
How can I pass a parameter via Route::controller to a controller? I want to pass a parameter user_id to getCreate method in my controller Route::controller('account', 'ReportController', array( 'getCreate' => 'client.account.create', 'postStore' => 'client.account.store', )); Controller public function getCreate($user_id = null) { // need to do something here with $user_id }...

laravel 5 boilerplate app not working

php,laravel,laravel-4,laravel-5,laravel-routing
i am new to laravel framework, as a first ever application with the framework i tried to create a minimal application for that i want to know how can i view the default auth, login, register pages found under routes.php? Route::get('/', '[email protected]'); Route::get('home', '[email protected]'); Route::controllers([ 'auth' => 'Auth\AuthController', 'password' =>...

Create a Dynamic URL and Redirect to it in Laravel

php,laravel,laravel-4,laravel-routing
So basically this is what I need. I have a router definition like this. Route::get('view/{postId}', '[email protected]'); Above router definition will get triggered if the url we request is www.domain.com/view/4. But what I want is I want to appear this url like www.domain.com/[category-of-post]/[titile-of-post] (Ex : www.domain.com/music/easy-chords-in-guitar). In PostController, I will get...

Laravel 5 500 internal error when using Request

php,laravel,laravel-5,laravel-routing
Hello ! I'm a beginner with Laravel. I wanted to experiment a little, so I made a basic controller using make:controller and started playing in its index() function. I simply wrote this : return "Hello - ".Request::ip()." - ".Input::get('id'); And get a 500 internal server error when calling to the...

Laravel multiple optional parameter not working [duplicate]

php,laravel,routing,laravel-5,laravel-routing
This question already has an answer here: Laravel 4 : How to pass multiple optional parameters 2 answers While using following route with 2 optional parameters, Route::get('/abc-{abc_id?}/xyz-{xyz_id?}', function($abc_id=0, $xyz_id=0) { return "\n hello ... World"; }); For requests /abc-1/xyz-15 - Hello World /abc-1/xyz - Hello World But for /abc-/xyz-15...

Laravel 5 QueryException When I try to call Edit Function

laravel-routing
I am learning about Laravel 5 and studying from this source https://laracasts.com/series/laravel-5-fundamentals/episodes/13 But when I try to make my own project which involves editing like the source taught me, I got "QueryException in Connection.php line 620:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'mscustomer.id' in 'where clause' (SQL: select * from...

Getting an error in passing a variable through routes to controller in laravel

php,mysql,laravel,laravel-routing
In app\routes.php Route::get('author/(:any)',array('as'=>'author','uses'=>'[email protected]_view')); In app\controllers\AuthorsController.php <?php class AuthorsController extends BaseController { public $restful=true; public function get_view($id){ return View::make('authors.view') ->with('title','Author View Page') ->with('author',Author::find($id)); } } In views\authors\view.blade.php <!DOCTYPE html> <html> <head> <title> {{ $title }}</title> </head> <body>...

Laravel add domains to controller routes

laravel,laravel-4,routing,laravel-routing
I have a Laravel App and a domain to access it. The Domain points to the public folder and executes the '/' route which then executes a certain method '[email protected]' in a controller.Now I want to add another domain. But this domain should execute another method '[email protected]' (route can be...

Should users be a resource in Laravel?

php,authentication,laravel,laravel-routing
In a Laravel application with user authentication, should the users be a resource? Route::resource('user', 'UserController'); And if so, what would be a proper way to handle authentication? Adding login and logout methods to the UsersController? Right now I have the following routes that handle the registration and authentication process Route::get('/login',...

Request::getQueryString() without some parameters

laravel,laravel-5,laravel-routing,laravel-request
I am using the following code to append the query strings with two links. But I want to exclude the page parameter of pagination from the query string. <li><a href="/teachers?{{ Request::getQueryString()}}">Teachers</a></li> <li><a href="/courses?{{ Request::getQueryString()}}">Courses</a></li> What is the way to do it? I tried the following code but it generates error....

What does “as” keyword really mean in Laravel routing?

laravel,laravel-routing
as i understand by laravel documentation, its used for redirection, may be i am not right. i wrote Route::get('user/profile', ['as' => 'profile', function () { echo 'some_text'; }]); then i was expecting my url redicted from https://base_url/public/index.php/user/profile to https://base_url/public/index.php/profile but it doesn't happen. Overall i want to know, what is...