laravel-4

Subclassing Migrator not working for namespaced migration

断了今生、忘了曾经 提交于 2019-12-14 02:38:50
问题 I have some namespaced migrations, and I can't get past the Class Not Found errors due to namespacing. In an earlier question, Antonio Carlos Ribeiro stated: Laravel migrator doesn't play nice with namespaced migrations. Your best bet in this case is to subclass and substitute the Migrator class, like Christopher Pitt explains in his blog post: https://medium.com/laravel-4/6e75f99cdb0. I have tried doing so (followed by composer dump-autoload , of course), but am continuing to receive Class

laravel loop over collection

北城余情 提交于 2019-12-14 02:36:00
问题 I have this code: $data = new Restaurant(array('id' => $restaurant_id)); $data = $data->waitingtimes(); foreach($data as $oneTime){ echo $oneTime->value; } exit; as you see, I tried to print the value attribute for each $data , but I got empty results. However, when I do this: $data = new Restaurant(array('id' => $restaurant_id)); $data = $data->waitingtimes(); echo $data->first()->value; exit; I get results, so the $data absolutely has values in it. I tried to read the basecollection class

Form submits as GET Laravel 4

≯℡__Kan透↙ 提交于 2019-12-14 01:59:11
问题 I have form like this <form action="{{ Request::root() }}/articles/update/" method="post"> <input type="hidden" name="id" value="{{ $article->id }}" /> <input type="submit" name="submit" value="Submit" /> </form> And route like this Route::post('articles/update', array('as' => 'articleUpdate', 'uses' => 'ArticlesController@update')); But when I submit the form, I get MethodNotAllowedHttpException . In error report I can see that request method is GET. I have also tried using caps for method

Does the creditCard function exist in Omnipay PayPal Express? Or only in PayPal Pro?

非 Y 不嫁゛ 提交于 2019-12-14 01:57:24
问题 This question is maybe similar to THIS and THIS but I'm not entirely sure. I've made a shopping cart that sends the product details and quantity/total amount to Paypal on checking out. I'm using Laravel 4 and the Omnipay Paypal plugin (Paypal_Express). I can send product details fine using the 'setItems' function and am now looking to pre-populate the credit card field on the Paypal summary page with my User's details. I have seen in other SO threads such as THIS that other people use the

PHP/Laravel/Bootsrap fetch data

人走茶凉 提交于 2019-12-13 22:57:09
问题 I've got an tiny little problem. I've got a table in database called 'player_skills'. It contains columns like this (example): player_id | skill_id | value | count 15 0 10 12 15 1 10 51 ... 15 8 10 12 The player_id is actually an id of the player which is column 'id' under 'players' table. Also there are eight skills. Value is the default value (which is irrelevant in this case). The count is the value (the value of the players skill). Basically, what I want is to pull data into a Bootstrap

How can i access this multi URL in laravel 4?

你说的曾经没有我的故事 提交于 2019-12-13 22:15:34
问题 How can i access this multi URL in laravel 4.2. http://localhost/new/public/library/course/1/First%20Video My code is Route::get('library/course/{id}', function($id){ return View::make('course')->with('id',$id); }); Route::get('library/course/{id}/{video}', function($id, $video){ $array = array('id' => '$id', 'video' => '$video'); return View::make('course')->withvideos($array); }); 回答1: You are accessing the URL correctly, and it should reach your second route. But you have a bug in your

Performing a Groupwise Maximum in Laravel 4

我们两清 提交于 2019-12-13 21:09:23
问题 What's the best way to perform a groupwise maximum using Laravel's Eloquent ORM such that it returns instances of models? 回答1: Based on this stackoverflow answer, I was able to create the following: $query = MyModel ::from(DB::raw( 'my_models NATURAL JOIN ( SELECT user_id, MAX(created_at) created_at FROM my_models GROUP BY user_id ) t' )) ; 来源: https://stackoverflow.com/questions/17043309/performing-a-groupwise-maximum-in-laravel-4

How to create a custom macro in laravel 4

流过昼夜 提交于 2019-12-13 21:05:28
问题 Good Day how can I use a custom macro in laravel 4? here is my custom macro <?php HTML::macro('flash', function() { $message_status = Session::get('status'); $message = Session::get('message'); $type = Session::get('type'); return ($message_status && $message) ? '<div class="alert alert-'.$message_status.'"><a class="close" data-dismiss="alert" href="#" aria-hidden="true">×</a><p>'.$message.' '.$type.'</p></div>':''; }); ?> I created a new file inside app folder named macros.php and paste the

Call to undefined Builder::save() when saving a polymorphic relationship

China☆狼群 提交于 2019-12-13 21:00:10
问题 I'm trying to save a polymorphic relationship when registering a user, but it returns me: Call to undefined method Illuminate\Database\Query\Builder::save() I have 3 tables on my database: Schema::create('usuarios', function(Blueprint $table) { $table->increments('id'); $table->string('nombreUsuario', 20); $table->string('password', 60); $table->string('email', 30); $table->string('remember_token', 100)->nullable(); $table->integer('cuenta_id'); $table->string('cuenta_type'); $table-

laravel how to update a field to a database

瘦欲@ 提交于 2019-12-13 20:46:19
问题 This is my code $admin = Admin::find(25); $admin->picture = $destination; $admin->save(); but when I execute it, the picture field is keep NULL for example images/admin_20 the destination is a string to the location of the image. I already tried ->update() but also nothing becomes saved. could you help me please Edit 1 the picture column in my database is varchar(255) utf8_unicode_ci 回答1: Try this: $admin = Admin::where('id', '=', 25); $admin->picture = $destination; $admin->save(); You didn