laravel-4

Laravel all routes except '/' return 404

只谈情不闲聊 提交于 2019-12-07 15:59:08
问题 As the title says, all the routes in my laravel app except the home('/') route result in a 404 error. I have separated the public folder from the rest of the laravel app as represented in the folder structure below. EDIT: I have confirmed that this is not what's causing the problem. This error occurs on both the development system (local) and the production system (shared hosting). EDIT: I forgot to mention: routes work if I go to localhost/index.php/route_name Folder structure: (folder names

How to validate a email address domain in Laravel?

左心房为你撑大大i 提交于 2019-12-07 15:57:34
问题 In Laravel, how do I validate an email address and force it to have a suffix like g.go.edu ? 回答1: If you want to accept all emails that have suffix g.go.edu , you can use as rule both email and regex rules, for example: $rules['email'] = ['email', 'regex:/(.*)g\.go\.edu$/i']; 来源: https://stackoverflow.com/questions/29720750/how-to-validate-a-email-address-domain-in-laravel

Laravel 4: custom login and check password

心已入冬 提交于 2019-12-07 15:34:35
I would like to customize my login in laravel 4 where username is either his username or email so what I did is: public static function custom_login($uname,$pwd) { $res = DB::select("select * from users where (username = ? or email = ?) and password = ? and active = 1",array($uname,$uname,$pwd)); return $res; } Now, we all know that password are hashed so you cant use password = ? . how can I check the password if it's correct? You can use $password = Hash::make($password); function to get the hash of password, and then check it Andreyco I agree with guys here with the principle, but I would

Laravel-4 routes with parameters gets called twice

狂风中的少年 提交于 2019-12-07 15:22:31
问题 I noticed strange behaviour occuring for my activation route for an application that I'm developing using laravel and after hours of debugging through xdebug etc, it came into an observation that my route was actually called twice at times. To recreate the situation, I created a fresh new laravel project with default files and just added a simple route as a test that does the following: Route::get('/activate/{code}', function($code) { file_put_contents('/home/fa/testproj/route_called.txt',

How do I change the domain when using URL::action()

空扰寡人 提交于 2019-12-07 14:23:06
问题 I am trying to duplicate something that was available in Laravel 3. I want to be able to specify an alternate domain name for a route. For example, I have a route that produces the following with this code: URL::action('DashboardController@something') // Produces: http://somedomain.com/dashboard/something I want to be able to specify a different domain. This used to be in the config/application.php file as 'url'. This no longer works in L4. Is there a way to specify a base url to use whenever

Accepting an encoded URL in a Laravel 4 route

拟墨画扇 提交于 2019-12-07 13:57:45
问题 I'm developing a website in Laravel 4 Beta 5 and I'm trying to pass on an encoded URL to the router. The problem is, an encoded URL has percentages etc. in it, so it is blocked by Laravel. The URL is encoded with the Javascript function encodeURIComponent() . Is there a way to override Laravel so I can use any character in my route? This is my current code: Route::get('add/{encoded_url}', function($encoded_url) { return 'The URL is: '.rawurldecode($encoded_url); }); I have tried to override

Laravels neat testing helpers in workbench?

限于喜欢 提交于 2019-12-07 13:46:32
Looking at the laravel testing documentation , you get an idea of all the cool helpers I'd love to use in workbench. Sadly I'm unable to do so. Illuminate\Foundation\Testing\TestCase seems to be unavailable when running my tests from the package directory and therefore i can't extend it. <?php namespace Acme\Foo; class TestCase extends \Illuminate\Foundation\Testing\TestCase { /** * Creates the application. * * @return \Symfony\Component\HttpKernel\HttpKernelInterface */ public function createApplication() { $unitTesting = true; $testEnvironment = 'testing'; return require __DIR__.'/../../../.

SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql1.alwaysdata.com:3306' (2)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 13:38:22
问题 I have this error when i try to access to some web pages of my project: SQLSTATE[HY000] [2005] Unknown MySQL server host 'mysql1.alwaysdata.com:3306' (2) alwaysdata is the phpmyadmin website I use for my database. I noticed that it's when I try to access in some pages in relation with the database (create user for example... etc) and there's no problems with other pages like 'contact'. I'm on mac OSX and I use MAMP server, always data, laravel and netbeans IDE. all configurations required to

Running beanstalkd worker on a remote server

我只是一个虾纸丫 提交于 2019-12-07 12:22:44
问题 My stack set-up consists of the following Machine1 - Main Server (Running laravel) Machine2 - MySql Server for the laravel codebase Machine3 - Beanstalkd worker I have setup Supervisord on Machine1 and added the following queue listener [program:queue1] command=php artisan queue:listen --queue=queue1 --tries=2 ... My laravel queue config file(app/config/queue.php) reads the following 'beanstalkd' => array( 'driver' => 'beanstalkd', 'host' => '--- Machine3 IP ---', 'queue' => 'queue1', 'ttr' =

Laravel Back to page with old input for validation

此生再无相见时 提交于 2019-12-07 11:58:38
问题 For the Update Profile Page I use the route as Route::get('editdriver/{data}', 'DriverController@EditDriver'); And in the controller after validation i use, return Redirect::to('editdriver/'.$data)->withInput()->withErrors($validation->messages()); So, the url will be http://localhost/project/editdriver/1 If i empty the value which is required in the rule and press submit the form, It shows the old data with the validation message. What i need is, It should not show the old value, which is