laravel-4

Rachet chat application - connection closed immediately after established when the app runs for a period of time

自作多情 提交于 2019-12-07 11:26:20
We're using Laravel 4 together with Ratchet to create a chat application. Everything runs normally for about 14-20 hours. After a period of time the chat app stops to run. The connection gets established from the client to the server but right after that the server closes the connection. No errors get reported in our log files and the fact that we haven't been able to replicate the problem in our development environment doesn't help. Restarting the chat application on the server fixes the issue for another 14-20 hours. Supervisor configuration: [program:chat] command = bash -c "ulimit -n 10000

Form Model Binding for checkboxes

送分小仙女□ 提交于 2019-12-07 11:24:19
问题 I'm using Laravel 4.1 and in my app I need to show a form with pre filled checkboxes. But I try to do it with using Form Model Binding, it doesn't work. {{ Form::model($user, array('route' => 'settings-notify')) }} <div class="formRow form-horizontal_row"> {{ Form::checkbox('notify_visit', '1') }} </div> <div class="formRow form-horizontal_row"> {{ Form::checkbox('notify_rate', '1') }} </div> <div class="formSubmit"> {{ Form::submit('Save') }} </div> {{ Form::close() }} Is there any way to

Laravel 4 Auth works but does not stay logged in

混江龙づ霸主 提交于 2019-12-07 11:18:27
In my Laravel 4 App I use the Auth functionality. I submit my login form to: $data = array( 'email' => Input::get('email'), 'password' => Input::get('password') ); if (Auth::attempt($data)) { echo 'SUCCESS!'; } This outputs SUCCESS, hence everything works. But if I next call another method the user is not logged in: if (Auth::check()) { echo "logged in"; } else { echo "not logged in"; } This outputs 'not logged in'. I tried to add true to attempt to remember login but it does not make a diference. I have another Laravel App with Auth running that works perfectly. Any ideas what the reason

How to use update Resource Controllers laravel 4?

那年仲夏 提交于 2019-12-07 11:02:25
问题 I have Customer Controller with index, edit, update methods Route::resource('customer', 'CustomerController'); Controller methods update public function update($id) { echo $id; } my HTML Form <form action="/customer/1" method="post"> <input type="text" name="email" value="" /> <input type="submit" value="" /> </form> I have following a Documentation here http://four.laravel.com/docs/controllers#resource-controllers PUT/PATCH /resource/{id} update It's seems not working for me, how to use it?

Laravel 4 get image from url

♀尐吖头ヾ 提交于 2019-12-07 10:39:09
问题 OK so when I want to upload an image. I usually do something like: $file = Input::file('image'); $destinationPath = 'whereEver'; $filename = $file->getClientOriginalName(); $uploadSuccess = Input::file('image')->move($destinationPath, $filename); if( $uploadSuccess ) { // save the url } This works fine when the user uploads the image. But how do I save an image from an URL??? If I try something like: $url = 'http://www.whereEver.com/some/image'; $file = file_get_contents($url); and then:

Print JavaScript variable value inside a php tag using blade template in Laravel

北慕城南 提交于 2019-12-07 09:30:43
问题 Suppose this is a JS code and I want to print the value of id . Here id is a variable with a value receiving into the jq function. function follow_or_unfollow(id,action){ myUrl = "{{ action('FollowsController@show', 'id') }}" ; } If we mension 'id' it will show the id string. PS. here {{ is using as it meant as php code in blade template. Now i need to print the script variable inside a php code. 回答1: I am afraid that what you are asking is not possible. The simple reason being JavaScript is

Laravel/Carbon Timestamp 0000-00-00 00:00:00 or Unexpected data found. Unexpected data found. Data missing

泪湿孤枕 提交于 2019-12-07 09:00:51
问题 I have a timestamp in the DB and am trying to get the swine to save. I either get an issue where the MySQL timestamp is blank or I get an error. The format posted is UK standard. Posting data, I have tried some of the following: $user['crb_date'] = Carbon::createFromFormat('d/m/Y', $data['crb_date']); $user['crb_date'] = Carbon::createFromFormat('d/m/Y', $data['crb_date'])->toDateTimeString(); // Plus many other more std date(), strtodate() combos On my Model, I have custom getDates which

i have error in laravel on function /vendor/guzzlehttp/psr7/src/functions.php on line 77 [duplicate]

自古美人都是妖i 提交于 2019-12-07 08:40:52
问题 This question already has an answer here : Difference in accessing arrays in PHP 5.3 and 5.4 or some configuration mismatch? (1 answer) Closed 4 years ago . I upload laravel 4 files on shared server and then i see this error. Parse error: syntax error, unexpected '[' in . /vendor/guzzlehttp/psr7/src/functions.php on line 77 in line 77: function stream_for($resource = '', array $options = []) 回答1: Short array syntax [] was added in PHP 5.4, so I guess you're running some older version of PHP

Populate select element

こ雲淡風輕ζ 提交于 2019-12-07 08:32:46
问题 I want to populate a <select> element using the results from my categories table. In order to do that I use the following code. $catlist = Categories::where('type','=',$content_type) ->get(array('id','name'))->toArray(); The result structure is an array of rows. array 0 => array 'id' => int 1 'name' => string 'article' 1 => array 'id' => int 2 'name' => string 'news' A foreach statement surely would solve my problem but I'm looking for a better solution. 回答1: You could use the lists(string

Form::file: How to repopulate with Input::old After Validation Errors and/or on Update?

ε祈祈猫儿з 提交于 2019-12-07 08:26:46
问题 In my PhotosController, I am trying to modify the edit action so that it shows the existing value in the Form::file() input field (and, so that it repopulates the field if validation fails). if ($validation->passes()) { // saves the image on the FS and updates the db entry } return Redirect::route('photos.edit') ->withInput(Input::all()) ->withErrors($validation) ->with('message', 'There were validation errors.'); The uploading process works fine, but when I view an existing record, or if