laravel-4

Best method to use Bootstrap in Laravel 4

一笑奈何 提交于 2019-12-20 15:25:24
问题 I am using now Laravel 4, What is the best method to use bootstrap for my site? Is there some stuff I need to change and where do I put the css files? Someone said that I need to use the composer and another said that I need to use the artisan Thanks 回答1: Some things you must know about Laravel: It has directly nothing to do with your front end, including Twitter Bootstrap. Where you put your files is entirely up to you, but the public folder is (usually) where your public viewable files must

Best method to use Bootstrap in Laravel 4

倾然丶 夕夏残阳落幕 提交于 2019-12-20 15:25:17
问题 I am using now Laravel 4, What is the best method to use bootstrap for my site? Is there some stuff I need to change and where do I put the css files? Someone said that I need to use the composer and another said that I need to use the artisan Thanks 回答1: Some things you must know about Laravel: It has directly nothing to do with your front end, including Twitter Bootstrap. Where you put your files is entirely up to you, but the public folder is (usually) where your public viewable files must

Laravel 4: Deploy custom artisan command in package

自闭症网瘾萝莉.ら 提交于 2019-12-20 14:39:17
问题 I have developed some custom artisan command for easier use with my package. Is it possible to include the artisan command into the package for easier deployment? If can, how? Thanks. 回答1: Having a command set in your package structure: <?php namespace App\Artisan; use Illuminate\Console\Command; class MyCommand extends Command { protected $name = 'mypackage:mycommand'; protected $description = 'Nice description of my command.'; public function fire() { /// do stuff } } You can, in your

Dynamically edit config/database.php file in Laravel

不羁岁月 提交于 2019-12-20 14:38:39
问题 First time when user runs my application i want to set database details as entered by the user in my application. Please let me know how i can edit config/database.php file in Laravel and update database credentials as provided by user. 'connections' => array( 'mysql' => array( 'driver' => 'mysql', 'host' => '*********', 'database' => '********', 'username' => '********', 'password' => '*******', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), ), 回答1: The simplest

Laravel 4 Cascading Soft Deletes

对着背影说爱祢 提交于 2019-12-20 14:15:30
问题 Is there a modular way to perform cascading soft deletes in L4? My database is already designed to do this with hard deletes because all tables are related to another.. however, I'm using soft deletes and really do not want to have to overload the delete() method in my models - simply due to (A) the amount of models, and (B) having to edit the delete() method in all models when other models change. Any pointers or tips would be appreciated. 回答1: I've got cascading deletes working using model

Nested 'AND OR' Query in Eloquent

别说谁变了你拦得住时间么 提交于 2019-12-20 11:14:08
问题 I'm currently attempting to create a nested query, as follows: public function getChallenge($user_id, $opponent_id) { $challenge = $this->challenges() ->where('open', true) ->where(function($query) use ($user_id, $opponent_id) { $query->where('player_1', $user_id) ->where('player_2', $opponent_id); }) ->orWhere(function($query) use ($opponent_id, $user_id) { $query->where('player_1', $opponent_id) ->where('player_2', $user_id); }) ->first(); return $challenge; } This creates the following

htmlentities() expects parameter 1 to be string, object given

≡放荡痞女 提交于 2019-12-20 11:04:12
问题 I am currently using Laravel 5 but any suggestions would be appreciated. I am currently using laravel's form builder and I keep getting this html entity error. I have tried even changing the textarea to a text field and much more to no avail. Below is my full stack trace. STACK TRACE ErrorException in helpers.php line 455: htmlentities() expects parameter 1 to be string, object given (View: /home/fujita/resources/views/emails/contact.blade.php) in helpers.php line 455 at CompilerEngine-

GitHub Client on OS X Commit Fail ("Failed to add file …)

*爱你&永不变心* 提交于 2019-12-20 10:33:52
问题 I am trying to commit changes I have made to my code (as usual) from my GitHub client on my Mac OS X Mavericks machine. I added a new package to my project (it's a Laravel project, and I added the package Rocketeer. I also made a few config changes). I am getting the error: Failed to add file laravel-master/vendor/anahki When I uncheck this file in the commit list, it then goes to another file showing this error. Failed to add file laravel-master/vendor/illumin Any idea what is going on? I

Override HTTP header's default settings (X-FRAME-OPTIONS)

若如初见. 提交于 2019-12-20 10:30:09
问题 I'm working with the dev version of Laravel (4.1.*) and there is a new default configuration that I don't want : X-Frame-Options: SAMEORIGIN For the moment I disable it by deleting one line in Illuminate\Http\FrameGuard.php I'm looking for a better solution. I've try in the filtre.php file : App::after(function($request, $response) { $response->header('X-Frame-Options', 'ALLOW-ALL'); }); But it just adds the option ( X-Frame-Options:ALLOW-ALL, SAMEORIGIN ), whereas I need an override. 回答1:

DB query builder toArray() laravel 4

无人久伴 提交于 2019-12-20 10:22:38
问题 I'm trying to convert a query to an array with the method toArray() but it doesn't work for the query builder. Any ideas for convert it? Example DB::table('user')->where('name',=,'Jhon')->get()->toArray(); 回答1: toArray is a model method of Eloquent, so you need to a Eloquent model, try this: User::where('name', '=', 'Jhon')->get()->toArray(); http://laravel.com/docs/eloquent#collections 回答2: If you prefer to use Query Builder instead of Eloquent here is the solutions $result = DB::table('user