我试图在Laravel 4上安装SASS.
我正在运行作曲家,并让我的composer.json设置如下:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.0.*",
"cartalyst/sentry": "2.0.*",
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
Run Code Online (Sandbox Code Playgroud)
我想知道在作曲家中是否有一种非常简单的方法可以将其添加为项目依赖性.
我想这样做的原因是因为它更易于管理,从长远来看它有助于构建.
如果有另一种方法来做它并安装grunt来缩小css/js那么那就更好了.
谢谢.
Laravel 5版
我正在开发一个带有新laravel 5版本的项目,由于某些原因我无法删除帖子,当我按下删除它只是将我重定向到带有id/post/3等id的帖子显示页面,我得到一个空白的白色页面,当我回到索引视图时,我收到了所有帖子,而且还没有删除.以下是我的内容:
发布迁移文件
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePostsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('posts', function(Blueprint $table)
{
$table->increments('id');
$table->string('title')->default('');
$table->string('slug')->default('');
$table->text('body');
$table->integer('author_id');
$table->string('author');
$table->string('featured_image');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('posts');
}
}
Run Code Online (Sandbox Code Playgroud)
PostsController
use Input;
use Redirect;
use Storage;
use SirTrevorJs;
use STConverter;
use Validator;
use Image;
use Boroughcc\Post;
use Boroughcc\Http\Requests;
use …Run Code Online (Sandbox Code Playgroud) 我正在构建的应用程序,Activeadmin用于后端界面.
我目前使用它来方便生产,为我的客户添加简单的东西到后端像产品等.
我已经设置了使用rails 4和activeadmin rails 4兼容版本.
当我在后端添加一个新乐队时,我收到此错误:
ActiveModel::ForbiddenAttributesError in Admin::BandsController#create
ActiveModel::ForbiddenAttributesError
Request
Parameters:
{"utf8"=>"?",
"authenticity_token"=>"YnzHk2juyZ6W2kVS5ZVPCimoj7LSHRI1Oen4BHjaqfc=",
"bands"=>{"title"=>"Kings of Leon",
"picture"=>"blank"},
"commit"=>"Create Bands"}
Run Code Online (Sandbox Code Playgroud)
我知道这与在后端创建新项目有关,但我不确定从哪里开始修复此错误.
任何帮助都会很棒,
谢谢
任何人都可以在这里提供帮助,我正在使用一个数组来分割一些数据,并且在附加到的视图上我得到了上面的错误.
这是我的代码:
用于ajax视图的PHP:
$images = array();
$data_link = array();
$data_id = array();
$data_likes = array();
$data_text = array();
foreach ($media as $data) {
//dd($data->caption);
$images[] = array(
//dd($data->caption),
"data_url"=>$data->images->standard_resolution->url,
"data_link"=>$data->link,
"data_text" => $data->caption['text'],
"data_id"=>$data->getId(),
"data_likes"=>$data->likes->count,
"data_like"=>$current_user->likes($data),
"data_token"=>$token
);
}
echo json_encode(array(
'next_id' => $media->getNextMaxTagId(),
'images' => $images
));
Run Code Online (Sandbox Code Playgroud)
然后我使用加载更多按钮访问数据.当我调试代码时,$data->caption我得到这个:
object(stdClass)#62 (4) {
["created_time"]=>
string(10) "1377775401"
["text"]=>
string(48) "New arrival #folkclothing reversible knit/jacket"
["from"]=>
object(stdClass)#63 (4) {
["username"]=>
string(18) "vanmildertclothing"
["profile_picture"]=>
string(76) "http://images.ak.instagram.com/profiles/profile_24567722_75sq_1342623790.jpg"
["id"]=>
string(8) "24567722"
["full_name"]=>
string(11) "Van …Run Code Online (Sandbox Code Playgroud) 我现在正在看fancybox v2.
我试图让一个画廊加载fancybox但手动调用.我不希望通过jquery加载图库图像最好从html页面加载它们,因为这将被添加到CMS的模板中,需要让用户将图像添加到库中填充他们上传的每个新图片.
是否只是在开始之前在选项中添加调用或在图像的标记的href中添加调用一样简单?
谢谢,马克
我已经构建了一个简单的应用程序laravel 4.我有脚手架设置添加帖子似乎工作正常.我已经设置了Stapler和图片上传包.当我设置使用单张图片上传时,它非常好,它的魅力.我最近看过这里的文档
它声明你可以进行多次上传,所以我按照文档中的说明去做.这是我的编码页面:
Post.php模型:
<?php
class Post extends Eloquent {
use Codesleeve\Stapler\Stapler;
protected $guarded = array();
// A user has many profile pictures.
public function galleryImages(){
return $this->hasMany('GalleryImage');
}
public static $rules = array(
'title' => 'required',
'body' => 'required'
);
public function __construct(array $attributes = array()) {
$this->hasAttachedFile('picture', [
'styles' => [
'thumbnail' => '100x100',
'large' => '300x300'
],
// 'url' => '/system/:attachment/:id_partition/:style/:filename',
'default_url' => '/:attachment/:style/missing.jpg'
]);
parent::__construct($attributes);
}
}
Run Code Online (Sandbox Code Playgroud)
PostsController.php
/**
* Store a newly created …Run Code Online (Sandbox Code Playgroud) php ×4
laravel ×2
laravel-4 ×2
activeadmin ×1
arrays ×1
compass-sass ×1
fancybox ×1
gruntjs ×1
jquery ×1
laravel-5 ×1
manual ×1
preg-replace ×1
ruby ×1
sass ×1