laravel-4

Do not understand why I keep getting this error: Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

南楼画角 提交于 2019-12-12 06:58:35
问题 I know this is a routing error but I can't find any errors in my routes. // comments Route::get('/comments', 'CommentsController@index'); This is the controller. /** * Display a listing of the resource. * GET /comments * * @return Response */ public function index() { return View::make('comments.create'); } Thank you in advance. It is probably an easy 15 points to someone. 回答1: I think the problem occurs when you try to submit your form. When you use: Route::get('/comments',

Confide custom validator

半世苍凉 提交于 2019-12-12 06:55:44
问题 I am using confide for user authentication. I wanna use custom rules using laravel's Validator (for firstname and lastname) class as in $validator = Validator::make($user, $this->rules[$ruleset]); and check with $validator->passes() . How can I achieve this? 回答1: First create your custom validation class. Something like this: class CustomValidator { /** * @return bool */ public function validateFirstname($attribute, $value, $parameters) { { // Do here your Firstname validation ... } /** *

Update table1 field with table2 field value in join laravel fluent

一曲冷凌霜 提交于 2019-12-12 05:48:01
问题 $table = 'favorite_contents'; $contents = DB::table($table) ->join('contents', function($join) use($table){ $join->on("$table.content_id", '=', 'contents.id'); }) ->whereIn("$table.content_id",$ids) ->update(array( "$table.expired" => 1, "$table.type" => "contents.type" )); The "$table.expired" => 1 is working fine, but the "$table.type" => "contents.type" doesn't. So the problem has something to do with getting the value of type in the contents table, how do I do this without resorting to

Lravel Mail not sending — Connection could not be established with host smtp.gmail.com [Connection timed out #110]

醉酒当歌 提交于 2019-12-12 05:29:22
问题 I just developed a laravel web application with mail system. i got error like Connection could not be established with host smtp.gmail.com [Connection timed out #110] controller Mail::send('timesheet/emailtemplate',array('data'=>$query),function($message) { $message->to('example@gmail.com')->cc('expalecc@gmail.com')->subject('Work Report on - '); }); email template file : emailtemplate.blade.php <h2>hai</h2> mail.php (config) 'driver' => 'smtp', 'host' => 'smtp.gmail.com', 'port' => 587,

Laravel 4.2 Sync multidimensional array in pivot table

只愿长相守 提交于 2019-12-12 05:28:35
问题 These are my tables with relation ship functions. issues table id issueName Every Issue has multiple question In Issue.php model public function questions() { return $this->hasMany('Question','issueID','id'); } questions table id issueID questionText questionScore every question belong to an Issue, it has its corresponding score In Question.php model public function issues() { return $this->belongsTo('Issue'); } Using radio input I am selecting a question for each Issue, and geting an array

Laravel 4: Eloquent::find() doesn't work

只谈情不闲聊 提交于 2019-12-12 05:20:08
问题 So I have a simple, empty Eloquent class: class Worker extends Eloquent {} . Then in the controller I write: Worker::find(1); and I get an exception, saying that the SQL is incorrect: select * where `id` = ? Obviously, the from SQL clause is missing. Oh, I downloaded the Laravel 4 for this app today. 回答1: In Laravel 4 you have to set a table property protected $table = 'foo'; 回答2: As already mentioned, you have to specifically set a $table property on the model. Taylor has mentioned here that

paginator call on query builder does not return paginator object in laravel 4 (in a specific case)

ぃ、小莉子 提交于 2019-12-12 05:18:44
问题 Problem: Query builder: $r = DB::table('someTable'); $r->where(....) $r->paginate(30, array(....)) return $r; Now calling a get_class() on $r gives Illuminate\Database\Query\Builder But after opening up vendor/laravel/framework/src/Illuminate/Database/Query/builder.php , i saw this, public function paginate($perPage = 15, $columns = array('*')) { $paginator = $this->connection->getPaginator(); if (isset($this->groups)) { return $this->groupedPaginate($paginator, $perPage, $columns); } else {

how to save multiple images in table using laravel php

不想你离开。 提交于 2019-12-12 05:14:23
问题 Hi please help me am new to laravel I want to store multiple images in table... With this code am unable to save. Help me for this.. Here in my View {{Form::open(array('url'=>'businessdirectory/business', 'files'=>true))}} {{Form::label('image','Upload Image')}} <div class="form-group">{{Form::file('image[]',array('multiple'=>true))}} </div> {{Form::close()}} In my Controller if(Input::file('image')) { $image = Input::file('image'); foreach($image as $img) { $destination = 'images'; $filename

Laravel, Facebook API: retrieving friends of friends

左心房为你撑大大i 提交于 2019-12-12 05:03:17
问题 In a previous thread we were strugling with the Facebook login using a Laravel app. Now, as the user logs into our app using Facebook, we are trying to get his friend's list in order to provide some qualified suggestions. So, here's what we are trying: Route::get('login/fb/callback', function() { // A FacebookResponse is returned from an executed FacebookRequest $helper = new FacebookRedirectLoginHelper('http://yoururl/login/fb/callback'); $session = $helper->getSessionFromRedirect();

Laravel Auth::attempt() return false [duplicate]

风流意气都作罢 提交于 2019-12-12 04:58:19
问题 This question already has answers here : laravel 4 custom named password column (4 answers) Closed 5 years ago . I have a problem with laravel 4.2 authentication. Auth::attempt() always return false. Hash::check() return false. I am tired to solve this problem. I read many tutorial and I can't find the solution. Here are some of my important files: my auth.php <?php return array( 'driver' => 'eloquent', 'model' => 'User', 'table' => 'users', 'reminder' => array( 'email' => 'emails.auth