laravel-4

Patchwork\Utf8\Bootup causing problems with Laravel 4

自古美人都是妖i 提交于 2019-12-30 09:00:14
问题 My project has been working fine until recently, when I ran sudo composer self-update . Composer successfully updated but I could no longer migrate ( php artisan migrate ). This is the error I get: PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in /Applications/MAMP/htdocs/ThumbsUp/bootstrap/autoload.php on line 46 I have ran composer update and composer install , and still this error persists. Why would it not be finding this class after the self-update ? 回答1: I had the same

Laravel Auth::logout not removing remember me cookie

拟墨画扇 提交于 2019-12-30 08:38:08
问题 So I have the lifetime of my sessions set to two weeks so users do not have to log in or out multiple times. However today I noticed something, if you log out it destroys your session but keeps the remember me cookie on your browser. This causes issues because if you switch accounts enough on the same computer 8-10 times you get a 400 bad request error because you are sending too much information. now 8-10 times in a normal lifetime of a cookie is kind of far fetched but when your lifetime is

Laravel 4 not refreshing

試著忘記壹切 提交于 2019-12-30 07:42:29
问题 I have a strange issue in laravel 4 as each time I try to refresh the page changes doesn't appear . For sure it's not browser's cache . Any help appretiated 回答1: I was having the same issues and found an answer: Try disabling OPcache in your php.ini If you use MAMP, it can be found at /Applications/MAMP/bin/php/php5.5.3/conf/php.ini And dont forget to restart MAMP. 回答2: I had a similar problem with the back-button, finally i noticed, that in my Laravel project no Cache-Control header was sent

Laravel redirect::route is showing a message between page loads

时光毁灭记忆、已成空白 提交于 2019-12-30 07:20:13
问题 I'm currently developing a web app using Laravel, and the app was working perfectly fine until recently. I had no idea what triggered it but here's a summary of the issue I'm having: Logging in used to work as I have an AccountController that does this: $auth = Auth::attempt(array( 'username' => Input::get('username'), 'password' => Input::get('password'), 'active'=>1); if ($auth) { return Redirect::route('home'); } return Redirect::route('account-sign-in'); And the home route looks like so:

laravel form post issue

跟風遠走 提交于 2019-12-30 06:54:30
问题 I am building a practice app with the Laravel framework I built a form in one of the views which is set to post to the same view itself but when I hit submit the form is posted however I do not get the desired output, I see the original view again. Here is my view index.blade.php @extends('master') @section('container') <div class="wrapper"> {{ Form::open(array('url' => '/', 'method' => 'post')) }} {{ Form::text('url') }} {{ Form::text('valid') }} {{ Form::submit('shorten') }} {{ Form::close(

Union queries from different databases in Laravel Query Builder

只愿长相守 提交于 2019-12-30 05:28:05
问题 I have two similar tables in two different databases. Both tables have a column with a date and one with email addresses. Though the column names are not the same. As result I want to have one result that contains all records from both tables. So my first step is: $emails_1 = DB::connection('db1')->table('contacts_1')->select('mail_address AS email', 'date as created_at'); $emails_2 = DB::connection('db2')->table('contacts_2')->select('email', 'created_at'); So now I have two results and the

Using a stored procedure in Laravel 4

 ̄綄美尐妖づ 提交于 2019-12-30 04:58:11
问题 I'm trying to call a stored procedure from via a laravel route and i keep getting an error: {"error":{"type":"Illuminate\\Database\\QueryException","message":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'emailAddress' in 'field list' (SQL: CALL getLibraryList(emailAddress))", I believe the call I'm making is correct: $result = DB::statement('CALL getLibraryList('.$email.')'); return $result; 回答1: Found out a way to get this working here: $result = DB::select('call getLibraryList(?)

How to apply multiple filters on Laravel 4 route group?

筅森魡賤 提交于 2019-12-30 04:34:06
问题 Is it possible to add multiple filters on a group route in Laravel 4? I have 2 authentification methods for an API centric application. One with standard authentification (filter "auth" for website), one with token (filter "auth.token" for mobile app). <?php Route::group(array('prefix' => 'api/'), function() { #Custom routes here }); ?> Ideally I'd like that if one of the two filters pass , group is accessible. 回答1: You can: Route::group(['before' => 'auth|csrf'], function() { // }); However

Best Practice for Errors in RESTful API

这一生的挚爱 提交于 2019-12-30 04:29:09
问题 What are the best practices for returning HTTP status codes in RESTful API? I am using Laravel 4 for my PHP framework. In the case of an error, should I use return Response::json('User Exists', 401); or include flag for success return Response::json([ 'success' => false, 'data' => 'User Exists'], 401 ); or use 200 instead of 4xx, relying on success to determine if there is an error return Response::json([ 'success' => false, 'data' => 'User Exists'], 200 ); And in the case of success and

How to get the values for a series of checkboxes in Laravel 4 controller (if checked)

♀尐吖头ヾ 提交于 2019-12-30 03:07:10
问题 I would like to get the values for a series of checkboxes I have set up in a Laravel 4 form. Here is the code in the view setting up the checkboxes: @foreach ($friends as $friend) <input tabindex="1" type="checkbox" name="friend[]" id="{{$friend}}" value="{{$friend}}"> @endforeach In my controller, I would like to get the values for the checked boxes and put them in an array. I am not exactly sure how to do this, but I assume it is something like: array[]; foreach($friend as $x) if (isset