laravel-4

The Response content must be a string or object implementing __toString(), \“boolean\” given."

丶灬走出姿态 提交于 2019-12-03 20:41:01
问题 I'm trying to return a rendered View using Response::json but I'm getting this error: The Response content must be a string or object implementing __toString(), \"boolean\" given." This is my code: $posts = Post::where( ... )->orderBy( ... )->get(); $data['posts'] = View::make("posts.partials.loadHome")->with("posts", $posts)->render(); $data['msg'] = "ok"; return Response::json($data); If I var_dump($data) I get this: <pre class='xdebug-var-dump' dir='ltr'> <b>array</b> <i>(size=2)</i>

How to use Illuminate Database Query Builder & Eloquent in other framework with PHP 5.3.x

可紊 提交于 2019-12-03 20:26:40
I did a couple of projects with Laravel in the past but now I need something very light for a project and went to use Slim, it works great for what I need and I want the great Eloquent ORM and Query Builder of Laravel, can't go without it now :) Now I manage to get it all working with composer, using the information that Taylor displayed on his GitHub, copied his piece of code use Illuminate\Database\Capsule\Manager as Capsule; $capsule = new Capsule; $capsule->addConnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => '', 'username' => '', 'password' => '', 'charset' => 'utf8',

laravel - blade templates layout structure add row-fluid for each 4 spans

限于喜欢 提交于 2019-12-03 20:19:22
I have this blade template <div class="row-fluid"> @foreach($courses as $course) <div class="span3 learn"> Content </div> @endforeach Output <div class="row-fluid"> <div class="span3 learn"> Content </div> <div class="span3 learn"> Content </div> <div class="span3 learn"> Content </div> <div class="span3 learn"> Content </div> <!-- this span should be in a spearted row-fluid div --> <div class="span3 learn"> Content </div> </div> this code adds a block of span3 size I use Twitter bootstrap reponsive I need to add row-fluid for each 4 spans in the row-fluid div I want the output to be like this

Mcrypt PHP extension required in Laravel [duplicate]

二次信任 提交于 2019-12-03 20:14:06
This question already has an answer here: Laravel requires the Mcrypt PHP extension 22 answers I'm trying to install Laravel on Linux Ubuntu. I'm running Ubuntu 14.10. Everything worked alright. But now instead of getting the supposed page when accessing localhost I get the message: " Mcrypt PHP extension required " I'm copying some information from terminal to help pinpoint the problem. which php /usr/bin/php php --ini Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files

Laravel 4: Redirect to a given url

倖福魔咒の 提交于 2019-12-03 18:57:50
问题 Is there a method in Redirect class of laravel where the parameter is a complete url? We all know parameters to these methods are just route name,action, slash,..etc but what I want now is like return Redirect::foo('https://bla.com/?yken=KuQxIVTNRctA69VAL6lYMRo0'); 回答1: Yes, it's return Redirect::to('http://heera.it'); Check the documentation. Update: Redirect::away('url') (For external link, Laravel Version 4.19): public function away($path, $status = 302, $headers = array()) { return $this-

How do I set up phpMyAdmin on a Laravel Homestead box?

若如初见. 提交于 2019-12-03 18:18:22
问题 I installed it by running sudo apt-get install phpymyadmin and then running sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html and sudo service nginx restart but it's not working. Note : I didn't select any of the apache2 or lighttpd options when installing. 回答1: Option 1: This will install the latest version of PhpMyAdmin from a shell script I've written. You are welcome to check it out on Github. Run the following command from your code/projects directory: curl -sS https://raw

How to manually create a new empty Eloquent Collection in Laravel 4

烂漫一生 提交于 2019-12-03 17:58:07
问题 How do we create a new Eloquent Collection in Laravel 4, without using Query Builder? There is a newCollection() method which can be overridden by that doesn't really do job because that is only being used when we are querying a set result. I was thinking of building an empty Collection, then fill it with Eloquent objects. The reason I'm not using array is because I like Eloquent Collections methods such as contains . If there are other alternatives, I would love to hear them out. 回答1: It's

Laravel pre-filling multiple forms if validation failed

安稳与你 提交于 2019-12-03 17:37:13
One of the coolest Laravel feature is, Laravel pre-filled the form fields if validation error occurred. However, if a page contain more than one form , and form fields have same name , Laravel pre-filling all forms fields . For example: I have a page where i have two forms to create new users or whatever. <h1>Create user1</h2> {{ Form::open(array('url' => 'foo/bar')) }} {{ Form::text('name', null) }} {{ Form::email('email', null) }} {{ Form::close() }} </h1>Create user2</h1> {{ Form::open(array('url' => 'foo/bar')) }} {{ Form::text('name', null) }} {{ Form::email('email', null) }} {{ Form:

laravel 4 installation problems

瘦欲@ 提交于 2019-12-03 17:33:36
i have been struggling with this for about 20 hours now and i cannot move forward. I am hopeless and tired from all that searching. Dont know where else should i try to find the solution. At the begining i should probably say that i am not a terminal/composer/git user. I am trying to install the laravel 4 framework. I have been googling a lot and found some tutorials, some of the even here on stackoverflow but noting really helped me. I have the basic github master zip package extracted at my localhost. I have installed composer i have also installed git on my local machine. I have uncommented

Laravel 4 : Call to undefined method Redis::connection()

旧时模样 提交于 2019-12-03 17:21:03
问题 I'm going crazy about this error. I've got a vagrant VM with Debian 7, generated with Puphpet, installation was fine. 1. Redis is installed and working redis-server is running : I can use the server on 127.0.0.1:6379 : 2. php5-redis is installed php5-redis is actually installed : 3. Laravel Redis config is set Here is my redis config file in app/local/database.php : 'redis' => [ 'cluster' => false, 'default' => [ 'host' => '127.0.0.1', 'port' => 6379, 'database' => 0, ], ], 4. The call to