小编You*_*taf的帖子

删除/删除laravel项目

嗨我正在尝试第一次发现laravel我开始使用laravel 4.2我刚创建了一个新项目但是我误以为我写了这样的命令行

composer create-project laravel/laravel {wamp/www/myProject} 4.2 --prefer-dist
Run Code Online (Sandbox Code Playgroud)

当我看到我的www目录时,我发现项目阶段是这样的C:\wamp\www\{wamp\www\myProject}

现在我意识到创建项目命令应该是这样的 composer create-project laravel/laravel myProject 4.2 --prefer-dist

现在我可以解决这个问题而不删除项目并重新创建它或者我应该删除并重新创建项目

并且只是去我的wampServer手动删除项目或者通过作曲家有一个特殊的命令.

问候

php laravel-4

11
推荐指数
2
解决办法
3万
查看次数

一页中有多个 CKEditor

我试图将两个CKEditor放在同一页面上。这是我所做的:首先ckeditor config.js

CKEDITOR.editorConfig = function( config ) {
    config.language = 'en';
    // config.uiColor = '#AADC6E';

    CKEDITOR.stylesSet.add('my_custom_style', [
        { name: 'Page Title', element: 'h2', attributes: {'class': 'general-title min'} }
    ]);

    //Config the KCFinder
    config.filebrowserImageBrowseUrl = "/laravel-filemanager?type=Images";
    config.filebrowserImageUploadUrl = "/laravel-filemanager/upload?type=Images&_token=";


    config.toolbarGroups = [
        { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
        { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
        { name: 'forms', groups: [ 'forms' …
Run Code Online (Sandbox Code Playgroud)

javascript forms jquery ckeditor

6
推荐指数
1
解决办法
6255
查看次数

Laravel:SQLSTATE[42S22]:未找到列:1054 未知列

我有三个表(服务、服务_产品、服务_产品_翻译)

尝试插入新产品时出现此错误

SQLSTATE[42S22]:未找到列:1054 未知列“services_products.services_product_id”在“where 子句”中(SQL:select * from services_productswhere services_products. services_product_id= 3)

这是我的迁移服务迁移

Schema::create('services', function(Blueprint $table)
            {
                $table->increments('id');
                $table->binary('image');
                $table->timestamps();
            });
Run Code Online (Sandbox Code Playgroud)

services_products 迁移

Schema::create('services_products', function(Blueprint $table)
        {
            $table->increments('id');
            $table->integer('service_id')->unsigned();
            $table->binary('image');
            $table->binary('pdf');

            $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade');
            $table->timestamps();
        });
Run Code Online (Sandbox Code Playgroud)

这是翻译表

Schema::create('services_product_translations', function(Blueprint $table)
        {
            $table->increments('id');
            $table->integer('product_id')->unsigned();
            $table->string('title', 150);
            $table->longText('details');
            $table->string('locale')->index();

            $table->unique(['product_id', 'locale']);
            $table->foreign('product_id')->references('id')->on('services_products')->onDelete('cascade');
        });
Run Code Online (Sandbox Code Playgroud)

这是我的模特

服务

class Service extends \Eloquent
{

    use \Dimsav\Translatable\Translatable;

    public $translatedAttributes = ['title', 'brief'];
    public $translationModel = 'ServicesTranslation';

    public function servicesPro()
    {
        return $this->hasMany('ServicesProduct', 'service_id');
    }
}
Run Code Online (Sandbox Code Playgroud)

服务产品

class …
Run Code Online (Sandbox Code Playgroud)

php mysql database-migration laravel eloquent

3
推荐指数
1
解决办法
2万
查看次数

Laravel 5:以正确的方式将 implode() 与 Eloquent 结合使用

我有一个checkbox组,想将它们作为val(1,2,3) 插入我的数据库中。

这是我的刀片

<div class="form-group">
     @foreach($extra as $ext)
        <div class="checkbox">
           <label>
          {{ Form::checkbox('extra_services[]', $ext->id, null, ['class' => 'checkbox']) }}
          {!! $ext->title !!}
           </label>
        </div>
     @endforeach
</div>
Run Code Online (Sandbox Code Playgroud)

这是控制器

    $temp->currency = $request->currency;
    $temp->implode($request->extra_services, ',');
    $temp->save();
Run Code Online (Sandbox Code Playgroud)

我有

strtolower() 期望参数 1 为字符串,给定数组

将复选框值作为 (1, 2, 3) 插入数据库的正确方法是什么?

php laravel eloquent laravel-5

2
推荐指数
1
解决办法
3万
查看次数

Laravel 5.4:统计每个类别中的产品并通过 Eloquent 查询对其进行排序

我有两个,Models一个是Product,另一个是ProductCategory

我和两者之间都有关系

产品型号

public function productCategory() {
        return $this->belongsTo( ProductCategory::class, 'product_category_id' );
    }
Run Code Online (Sandbox Code Playgroud)

产品类别型号

public function categoryProduct() {
        return $this->hasMany( Product::class, 'product_category_id' );
    }
Run Code Online (Sandbox Code Playgroud)

现在每个类别都有一些产品,例如(cat-1 has 3 products, cat-2 has 7 products, cat-3 has 5 products)

我需要一个Eloquent query将按每个类别中的产品数量排序的 4 个类别。

对于前。

cat-2 has 7 products
cat-3 has 5 products
cat-1 has 3 products
Run Code Online (Sandbox Code Playgroud)

任务

php laravel laravel-eloquent

2
推荐指数
1
解决办法
3198
查看次数

Laravel 5.4:仅选择 2 天内的记录

我需要提取 2 天内的所有记录,例如今天是 24/7,所以我需要 23/7 和 22/7 的所有记录

我试试这个

->whereRaw('DATE(created_at) = DATE_SUB(CURDATE(), INTERVAL 2 DAY)')
Run Code Online (Sandbox Code Playgroud)

但不工作它从两天前获取记录也试试这个

->whereDate( 'created_at', '>', Carbon::now()->subDays( 2 ) )
Run Code Online (Sandbox Code Playgroud)

但它也包括我不想要的今天的记录。

我应该如何使用carbonDATE

date laravel php-carbon

2
推荐指数
1
解决办法
1407
查看次数