laravel-4

Laravel 4 migrate:rollback with --path on artisan CLI

独自空忆成欢 提交于 2020-01-03 10:57:28
问题 I'm having some roadblock on Laravel 4. Since I can't make artisan:migrate generate migrations from inner folders of app/database/migrations (ex: app/database/migrations/app1) I have this on my custom command app:migrate /* default path */ $this->call('migrate'); /* custom path */ $this->call('migrate', array('--path' => 'app/database/migrations/app1')); but i also want an app:refresh command which will rollback all the migrations from the custom path then from the default path.. then re

How do i unit test the auth filter in Laravel 4.1?

半城伤御伤魂 提交于 2020-01-03 08:49:10
问题 I want to write a unit test that should check if an unauthenticated user can view the user list (which he shouldnt be able to). My routes Route::group(array('prefix' => 'admin'), function() { Route::get('login', function() { return View::make('auth.login'); }); Route::post('login', function() { Auth::attempt( array('email' => Input::get('email'), 'password' => Input::get('password')) ); return Redirect::intended('admin'); }); Route::get('logout', 'AuthController@logout'); Route::group(array(

Using Dropzone.js inside Bootstrap modal

瘦欲@ 提交于 2020-01-03 08:41:33
问题 I'm using dropzone.js to upload files to the server. I included all the necessary js and css files and have put the file upload form inside a bootstrap modal. The problem I'm facing is that, inside the modal the file select window does not get triggered once I click on the dropzone. Nor am I able to drag and drop the required files. I'm using Laravel 4. Any direction on this issue would be great! Thanks in advance. This is my code: <script type="text/javascript" src="{{ URL::asset('js

Artisan serve send assets with response headers embedded

耗尽温柔 提交于 2020-01-03 05:37:32
问题 Maybe this is something obvious but I'm having a hard time, I just found out that my local PHP environment is delivering static files with the response headers embedded. This is Laravel 4.1.26 with PHP 5.5.11 on Fedora 20, already tested laravel serve and php -S localhost:8000 server.php , both with equal results. I tried with Firefox, Opera and Chromium, it looks like is displaying the raw binary response: This is causing errors on all my js files. For what is worth I tried curl and wget -q

Intervention not resizing large files

百般思念 提交于 2020-01-03 05:21:28
问题 I am using [Intervention][1] to resize Files. I figured out it is not resizing large files like this one Code I am using is: if (Input::hasFile('image')) { $file = Input::file('image'); $r = $file->move('uploads', $file->getClientOriginalName()); Image::make('/mountain.jpg')->resize(200,200)->save('uploads/k2.jpg'); //print_r($image); exit; } Code works fine for smaller files. The file size is 2.x MB and my PHP limit is 32MB. Update : Laravel Log says: ' with message 'Allowed memory size of

Laravel 4.2 and AJAX POST - 500 Internal Server Error

倾然丶 夕夏残阳落幕 提交于 2020-01-03 04:57:08
问题 I am puzzled by the following problem: I have a code that looks like this <form action="{{ URL::route('user-send-message') }}" method="post" id="form-user-send-message"> @if( $user_message_block ) <input id="msg-id" name="msg-id" type="hidden" value="{{ $user_message_block->id }}"> @else <input id="msg-id" name="msg-id" type="hidden" value="0"> @endif <input id="getter" name="getter" type="hidden" value="{{ $profile->user->username }}"> <textarea id="user-message" name="user-message"><

Laravel 4 - Composer Install fails every time, even though I'm using PHP 5.4

情到浓时终转凉″ 提交于 2020-01-03 03:11:13
问题 I'm running into issues installing Laravel 4... I am following the instructions posted here: http://badubizzle.blogspot.com/2013/01/setting-up-laravel-4-on-webfaction.html My host allows multiple versions of PHP to run at the same time, so running the command php will run php 5.2.17 on whatever you specify next. I know you need greater than php 5.3 to run Laravel 4, so I am using php 5.4 to do so. I can either specifically type php54 to run the command under php 5.4, or an alias can be made

Laravel Ajax Input::all() return empty when send it via FormData

好久不见. 提交于 2020-01-03 02:29:30
问题 im building an application with Laravel 4, in some point i want to add some model throught modal(Bootstrap) so i needed ajax to send my from, i have setup my route and action in controller, and then i have built the form markup with blade, i have wrote the ajax code, the request goes fine and i retrieve the inputs through Input facade, the problem here is that form has a file input, and when serialising form data with $('#formRub ').serialize(), it can't handle the file input, so i have to

Pass an array to Redirect::action in laravel

我是研究僧i 提交于 2020-01-02 20:24:45
问题 I'm trying to pass an array from a function to another function in laravel. In my PageController.php , I have public function show($code, $id){ //some code if(isset($search)) dd($search); } and another function public function search($code, $id){ //some queries $result = DB::table('abd')->get(); return Redirect::action('PageController@show, ['search'=>$search]); } But this returns me an error like this: ErrorException (E_UNKNOWN) Array to string conversion I'm using laravel. 回答1: You could

Laravel - is there a way to combine whereHas and with

让人想犯罪 __ 提交于 2020-01-02 08:31:51
问题 I'm currently facing a small problem. I want to return a model only if a relation with certain conditions exists. That's working fine with the whereHas()-method. $m = Model ::whereHas( 'programs', function($q) { $q->active(); } ); However, calling the relation as a property like this will give me all (not filtered results). $m->programs; So basically what I'm doing now is this: $m = Model ::whereHas( 'programs', function($q) { $q->active(); } ) ->with(array('programs' => function($q) { $q-