laravel-4

Laravel installation

不想你离开。 提交于 2019-12-08 14:20:18
问题 No existing questions are sufficiently basic to answer my problem. I am trying to install Laravel to try it out and have successfully installed Composer but all advice about installing Laravel itself seems to involve something called Git and a 'terminal' which I know nothing about. Can I not simply download a setup file and run it as for other apps? Mike 回答1: Install Laravel Framework in Windows: Created By : Chirag Shah PHP version greater than 5.3.7 is required Step 1 : Download Laravel

Testing a class that calls parent::function?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 14:09:26
问题 I have a model that overloads the where function. My overloaded method looks like this: public function where($column, $operator = null, $value = null, $boolean = 'and') { if (in_array($column, $this->metaFields)) { $value = '%"' . $column . '":"' . $value . '"'; $column = 'meta'; $operator = 'like'; } return parent::where($column, $operator, $value, $boolean); } Now using phpunit and mockery I am trying to test this class, I need to test my overloaded where function, all I really care about

Laravel 4 Basic Auth custom error

心已入冬 提交于 2019-12-08 14:02:26
I'm using the 'HTTP Basic Authentication' feature of laravel. I want to customize the error message which is generated from laravel if the entered credentials are wrong. Is it possible to catch the 401 Error which is generated when HTTP Auth fails? Hope you can help me. Regards Basic Auth Try to capture 401 error and return cusom view?! App::error(function($exception, $code) { switch ($code) { case 401: return Response::view('errors.403', array(), 401); case 403: return Response::view('errors.403', array(), 403); case 404: return Response::view('errors.404', array(), 404); case 500: return

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

最后都变了- 提交于 2019-12-08 13:57:31
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 in the .bash_profile to do so just when typing php, which is what I did. Now, when I run the command php

Class Comment not found Laravel 4

 ̄綄美尐妖づ 提交于 2019-12-08 13:41:22
问题 Im trying to add a comment system to my laravel app. But I can't seem to get it working. I have two models class Post extends \Eloquent { protected $table = 'posts'; public function comments() { return $this->hasMany('Comment','postId'); } } and my Comment model class Comment extends \Eloquent { protected $table = 'comments'; public function post() { return $this->belongsTo('Post'); } } in my DashBoardController I'm trying to get the output from the models use App\Models\Post; use App\Models

Laravel: Google contacts API gives empty results

情到浓时终转凉″ 提交于 2019-12-08 11:28:22
问题 I am trying to use Laravel 4.2 + OAuth2. I am using this package: ardarek-oauth-4-laravel for Laravel. Here are my related files. Problem: Unable to retrieve Google contacts lists. // Config - app/config/packages/artdarek/oauth-4-laravel/config.php - 'consumers' Google' => array( 'client_id' => '**********', 'client_secret' => '*******', 'scope' => array('https://www.googleapis.com/auth/tasks', 'https://www.google.com/m8/feeds/') ), // Controller public function importGoogleContacts() { $code

Laravel using UNION in query builder

自作多情 提交于 2019-12-08 11:27:25
I have an SQL query that works fine and I'm trying to convert into fluent:: SELECT DISTINCT tags.tag FROM tags, items WHERE tags.taggable_type = 'Item' AND items.item_list_id = '1' UNION SELECT DISTINCT tags.tag FROM tags, itemlists WHERE tags.taggable_type = 'ItemList' AND itemlists.id = '1' This is what I have so far in fluent, it all seems right as far as I can tell from the docs and the individual queries both work on their own, it's just when I UNION them it throws an error: $itemTags = Tag::join('items', 'items.id', '=', 'tags.taggable_id') ->select('tags.tag') ->distinct() ->where('tags

Laravel 4.1 authentication session data not persisting across requests

你说的曾经没有我的故事 提交于 2019-12-08 11:22:09
问题 I have a Laravel 4.1 app using the eloquent authentication driver and the database session driver. My authentication controller is successfully running Auth::attempt and redirecting to a new page. However, once on the new page the authentication session data seems to be gone. I have an auth filter running on the redirected-to page and it fails, which then redirects the user to the login page again. The user never gets past the login page. Here is my session.php: <?php return array( 'driver' =

Distinguish between validation errors in Laravel

旧街凉风 提交于 2019-12-08 11:20:58
问题 I'm using the validation rules in Laravel 4, which are very powerful. However, I wonder how one can distinguish between the different validations error that may occur. For example if I use the following rules: $rules = array( 'email' => 'required|email|confirmed', 'email_confirmation' => 'required|email', ); How can I tell what validation rule/rules that triggered the error for a certain field? Is there some way I can tell that the error was due to a missing email value, email wasn't a valid

How can rewrite url using htaccess when add custom foulder name in url

懵懂的女人 提交于 2019-12-08 11:16:42
问题 I want to rewrite my URL using htaccss .I am working project in laravel 4 .I need to add following names with url.but its showing error. The names are like , admin,government,bus,school My current site url is :http://localhost/myproject/ But i want to access url following like, 1)http://localhost/myproject/admin 2)http://localhost/myproject/government 3)http://localhost/myproject/bus 4)http://localhost/myproject/school This is my current .httacess code, <IfModule mod_rewrite.c> <IfModule mod