laravel-4

Parsley.js and Laravel Form Validation Errors

▼魔方 西西 提交于 2020-01-25 00:16:10
问题 I am using parsley.js for a client-sided validation and also want to use it for the server-sided validation (Laravel Form Validator) to show the errors using the parsley styling. So that it is uniform. So whenever my server-side validation fails, I would like to show the specific error associated to the correct field. I don´t want to use the remote library. Is there an example how to do this? Link to: Laravel Validator and Parsley Thank you very much! 回答1: You can do something like this: <div

Laravel routing system

痞子三分冷 提交于 2020-01-24 20:38:38
问题 I am working with laravel 4 and i have a problem with my routes, for example : //Route to display a campaign Route::get('campaigns/{name}', 'CampaignController@show'); //Route to create a campaign Route::get('campaigns/add', 'CampaignController@create'); The problem here is : the routing system thinks that the add in campaigns/add is a campaign name so it takes me to campaigns/{name} How can i fix it ? Any help would be greatly appreciated! 回答1: Laravel matches routes from the top down. So

Using Laravel Form class to add the 'disabled' attribute for some options

左心房为你撑大大i 提交于 2020-01-23 21:39:32
问题 Using Laravel 4's Form class, I have this list: {{ Form::select('set', $sets, $prod->set_id, array('class' => 'form-select')) }} How can I add the attribute disabled only for some options? 回答1: Try this; {{ Form::select('set', $sets, $prod->set_id, array('class' => 'form-select', 'disabled')) }} The last parameter you pass will end up being the HTML attributes. And you cannot restrict it for only some options. You can only disable the input field. If you don't want certain options omit them

Decrease product quantity in database after order is placed with Laravel

落爺英雄遲暮 提交于 2020-01-23 13:09:59
问题 I have cart on the site and so far everything work perfectly. Now I'm trying to make quantity for each product which admin can add in backend ( already done ) and when customer order product(s) to decrease quantity in database. So far as I said admin panel is ready and can add quantity to product which is saved in database. Here is my cart submit controller public function orderSubmit() { $cart = Session::get(self::CART_SESSION_KEY, array()); if (count($cart) < 1) { return Redirect::to('/');

Laravel 4 Can't find BaseController from namespaced controller

六月ゝ 毕业季﹏ 提交于 2020-01-23 11:46:38
问题 I'm trying to structure my Laravel 4 site such that (1) major application groups' components (controllers/views/etc) are coupled together and (2) Laravel's supporting code outside of in my web server's document root. The default laravel home page loads fine, but I can't get a namespaced controller to route correctly. This is the relevant file structure: / [Project Root] /laravel [full laravel install here] composer.json /app /controllers BaseController.php /dev /htdocs index.php /app

Laravel 4 Can't find BaseController from namespaced controller

大兔子大兔子 提交于 2020-01-23 11:44:14
问题 I'm trying to structure my Laravel 4 site such that (1) major application groups' components (controllers/views/etc) are coupled together and (2) Laravel's supporting code outside of in my web server's document root. The default laravel home page loads fine, but I can't get a namespaced controller to route correctly. This is the relevant file structure: / [Project Root] /laravel [full laravel install here] composer.json /app /controllers BaseController.php /dev /htdocs index.php /app

Laravel 4 Can't find BaseController from namespaced controller

☆樱花仙子☆ 提交于 2020-01-23 11:44:03
问题 I'm trying to structure my Laravel 4 site such that (1) major application groups' components (controllers/views/etc) are coupled together and (2) Laravel's supporting code outside of in my web server's document root. The default laravel home page loads fine, but I can't get a namespaced controller to route correctly. This is the relevant file structure: / [Project Root] /laravel [full laravel install here] composer.json /app /controllers BaseController.php /dev /htdocs index.php /app

Laravel 4 Can't find BaseController from namespaced controller

℡╲_俬逩灬. 提交于 2020-01-23 11:43:10
问题 I'm trying to structure my Laravel 4 site such that (1) major application groups' components (controllers/views/etc) are coupled together and (2) Laravel's supporting code outside of in my web server's document root. The default laravel home page loads fine, but I can't get a namespaced controller to route correctly. This is the relevant file structure: / [Project Root] /laravel [full laravel install here] composer.json /app /controllers BaseController.php /dev /htdocs index.php /app

Artisan returns blank

旧街凉风 提交于 2020-01-23 05:52:07
问题 Whenever I run any php artisan command like php artisan list , I get nothing back. No commands work at all. I have been searching a little around, and have tried the following: changing permissions for /root/.composer to 777 remove bootstrap/compiled.php file There is nothing in app/storage/logs/log-cli-.txt . I can view the site in the browser. I'm running on CentOS 6.3 64bit with PHP v. 5.5.11 - Laravel 4.1 回答1: This problem is pretty common and is usually related to some errors that are

how to check image dimensions before upload in laravel 4

ぐ巨炮叔叔 提交于 2020-01-23 03:34:05
问题 I am new in laravel 4. I want to upload photo with maximum dimensions 800x600. Please help to guide me! 回答1: you could simple use getImageSize(), as list($width, $height) = getimagesize(Input::file('file')); 回答2: Check validation like this if ($validator->passes() && correct_size(Input::file('file'))) { // do something } Create a validation function like this in which ever model you choose public function correct_size($photo) { $maxHeight = 100; $maxWidth = 100; list($width, $height) =