laravel-4

How to disable Kint in local environment under Laravel 4

我的未来我决定 提交于 2019-12-11 03:18:49
问题 I'm using Kint via Composer in Laravel 4 by loading kint first in composer.json so that dd() is defined by kint, not laravel (suggested here). I want to leave debug calls in my app, and disable Kint if not in the local environment. I'm successfully using config overrides for Anvard using the following structure: /app/config/local/packages/provider/package_name/overridefile.php Unfortunately, this is not working for Kint with the following structure: /app/config/packages/raveren/kint/local

Retrieve Values form Jquery Ajax Json in Laravel 4

人走茶凉 提交于 2019-12-11 03:15:49
问题 I'm trying to retrieve data from an Jquery Plugin which uses Ajax and Json in Laravel 4 The Plugin part is in the view customer.blade.php: <script> var $container = $("#dataTable"); var $console = $("#example1console"); var data = {{ $content }}; $("#dataTable").handsontable({ data: data, startRows: 6, startCols: 8, rowHeaders: true, colHeaders: [{{ $title }}] }); var handsontable = $container.data('handsontable'); $container.parent().find('button[name=save]').click(function () { //alert('we

How could I use one route with git for multiple developers in Laravel 4.2

放肆的年华 提交于 2019-12-11 03:12:30
问题 I have only one routes app/routes.php , I am using git /git-hub for sharing my projects with some developers. Cause they can work together. But problem is that : every one using same routes.php file for routing and when they push/pull in git this routes.php file conflicts all the time. Is there any way to set routes for different developer in same project ? 回答1: There is a silly way but fruitful:: create routes_demo.php :: here demo developer can work Include routes_demo.php in your main

laravel Hash::make keep giving a different results

谁说胖子不能爱 提交于 2019-12-11 03:12:13
问题 I want to use the authentication in laravel 4 I changed the table's and mobel's name when the user register, I has the password and save it, the hash is : $password = Hash::make(Input::get('password')); and then when the user login I want ot authenticate him/her first. I do that like this: if (Auth::attempt(array('username' => Input::get('usernaem'), 'password' => Hash::make(Input::get('password'))))) { return Redirect::intended('dashboard'); } and that never success. I tried to debug the

testing a POST using phpunit in laravel 4

耗尽温柔 提交于 2019-12-11 03:11:46
问题 I have a route that does a POST to create data and I'm trying to test if everything should be working the way it should be. I have a json string that will have the values that i want to test but so far the test is always failing when I run the test using phpunit: Also,I know the json string is just a string but I'm also unsure of how to use the json string to test for input. my route: Route::post('/flyer', 'flyersController@store'); public function testFlyersCreation() { $this->call('POST',

Laravel Selective Caching

拟墨画扇 提交于 2019-12-11 03:05:34
问题 I'm developing one of my first applications with the Laravel 4 framework (which, by the way, is a joy to design with). For one component, there is an AJAX request to query an external server. The issue is, I want to cache these responses for a certain period of time only if they are successful . Laravel has the Cache::remember() function, but the issue is there seems to be no "failed" mode (at least, none described in their documentation) where a cache would not be stored. For example, take

Extending Custom Validation-Class

左心房为你撑大大i 提交于 2019-12-11 02:53:14
问题 I've been experimenting with Laravel 4 recently and am trying to get a custom validation-class to work. Validation-Class <?php class CountdownEventValidator extends Validator { public function validateNotFalse($attribute, $value, $parameters) { return $value != false; } public function validateTimezone($attribute, $value, $parameters) { return !empty(Timezones::$timezones[$value]); } } My rules are setup like this: protected $rules = [ 'title' => 'required', 'timezone' => 'timezone', 'date' =

Generating New Array from Laravel 4 Input

孤者浪人 提交于 2019-12-11 02:48:23
问题 I'm getting some input from a dynamically generated form (I'm using jQuery to allow the user to add fields) using Input::all(). The field names are 'first_names[]', 'last_names[]' and 'emails[]'. The $input variable now looks like this: array (size=4) '_token' => string '3VCQFUmAx8BNbSrX9MqjGtQhYovOaqecRUQSAL2c' (length=40) 'first_names' => array (size=1) 0 => string 'John' (length=4), 1 => string 'Jane' (length=4) 'last_names' => array (size=1) 0 => string 'Doe' (length=3), 1 => string 'Doe'

Laravels Eloquent ORM: setting datatypes of the model

亡梦爱人 提交于 2019-12-11 02:46:41
问题 Currently I have a simple table with two rows: id and key . Whenever I try to get my data from the database with City::get() the response contains id columns in the string format. Is there a simple way/package how I can define the data formats for each of my columns? E.g. - id in this example should have been an integer. Model: <?php class City extends Eloquent { protected $table = 'cities'; protected $primaryKey = 'Id'; } Controller: class CityController extends \BaseController { public

How Laravel workbech package can auto boot another workbench package?

*爱你&永不变心* 提交于 2019-12-11 02:12:13
问题 In Laravel 4 I'm developing 2 distinct workbench packages at the same time. Packages work in conjunction but I want to keep things separated. When they will be ready, the second will depend on the first one through Composer and everything will run well (hope so)... but now: How to make the first ServiceProvider auto boot the second ServiceProvider without writing two lines in /app/config/app.php ?? Now they work great adding two lines into 'providers' in /app/config/app.php but I just want to