小编Vic*_*cky的帖子

如何使用Artisan命令(PHP)在Laravel 5.2中创建RESTful资源控制器

我正在使用Laravel 5,我想知道如何使用Artisan命令(PHP)生成所有预定义方法的RESTful资源控制器.

当我运行时php artisan make:controller LessonsController,它会创建一个控制器,没有如下所示的方法:

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;

class LessonsController extends Controller
{


}
Run Code Online (Sandbox Code Playgroud)

我想要创建的是一个完整的Laravel RESTful资源控制器,其中包含以下所有预定义方法:index(), create(), store(), show(), edit(), update()destroy().

我怎样才能做到这一点?

php ioc-container laravel-5.2

33
推荐指数
2
解决办法
4万
查看次数

Kotlin:Interface Queue没有构造函数

我正在尝试实例化Queue使用下面代码的对象

var queue: Queue<Int> = Queue()

但我明白了

Interface Queue没有构造函数

不知道发生了什么,搜索时我发现了这个链接.

但我什么都不懂.请帮忙.

kotlin

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

/ bin/sh:1:语法错误:反引号替换中的EOF

我在crontab中创建了一个新任务,如下所示:

*/2 * * * *       mongodump --db prodys --out /backup/databases/mongoDatabases/`date +"%m-%d-%y"`
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

/bin/sh: 1: Syntax error: EOF in backquote substitution
Run Code Online (Sandbox Code Playgroud)

请帮忙,我没有任何线索是什么错.

bash cron crontab ubuntu-14.04

12
推荐指数
1
解决办法
7246
查看次数

laravel 5.2.7 中的时间戳具有默认的空值

我正在使用Laravel Framework version 5.2.7. 我创建了一个数据库迁移,如下所示:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateLessonsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('lessons', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->text('body');
            $table->boolean('some_bool');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('lessons');
    }
}
Run Code Online (Sandbox Code Playgroud)

我进入了虚拟机的 MySql 数据库并使用了命令desc lessons;,这就是我得到的:在此处输入图片说明

我不明白为什么 docreated_atupdated_atcolums 有NULL作为Default. 我去了 Laravel 5.2 …

php mysql laravel-5.2

5
推荐指数
1
解决办法
9556
查看次数

Android Intent Service工作请求并行运行


我创建了一个IntentService,如下所示:

    public class OrdersSyncService extends IntentService {

    private static final String TAG = OrdersSyncService.class.getSimpleName();

    private Order orderObject;

    public OrdersSyncService() {
        super("OrdersSyncService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {

        //Util.showToast(getApplicationContext(), "Syncing Orders........");
        Log.d(TAG, "I'm running....");
        syncOrders();
    }

    private void syncOrders() {

        Database database = CouchBaseHelper.openCouchBaseDB(this);
        JSONArray ordersJsonArray = new JSONArray(CouchBaseHelper.retrieveNotSyncedOrders(database));
        if (ordersJsonArray.length() != 0) {
            uploadOrders(ordersJsonArray.toString());
            Log.d(TAG, "Orders syncing started.");
        } else {
            Log.d(TAG, "Nothing to sync.");
        }
    }

    private void uploadOrders(String ordersJsonArray) {

        RetrofitApi.ApiInterface apiInterface = RetrofitApi.getApiInterfaceInstance();
        final Call<Order> uploadOrders …
Run Code Online (Sandbox Code Playgroud)

android retrofit android-intentservice retrofit2

4
推荐指数
1
解决办法
2021
查看次数

当我断开wifi时,检查互联网连接的广播接收器被调用两次

这是BroadcastReceiver用于检查互联网连接,当我断开wifi时,它显示"无互联网"吐司两次.

InternetDetector的.java

package com.hfad.evenit;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.support.v7.app.AlertDialog;
import android.widget.Toast;

/**
 * Created by Vicky on 26-Sep-15.
 */

public class InternetDetector extends BroadcastReceiver {
    public InternetDetector() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {


        boolean isVisible = MyApplication.isActivityVisible();

        try {
            if (isVisible == true) {
                ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
                NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();

                // Check internet connection and accrding to state change the
                // …
Run Code Online (Sandbox Code Playgroud)

android broadcastreceiver

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