我遇到了大问题.我试图朗读php artisan migrate生成表迁移,但我收到
php artisan list错误.我试过并在互联网上搜索,我误解了,但我没有得到任何解决方案.
我也试过基表或查看未找到:1146表Laravel 5和做一个Laravel教程,得到"基表或视图未找到:1146表'sdbd_todo.migrations'不存在",但我没有成功.
我也试过跑php artisan migrate,但我又得到了同样的错误.我不知道为什么.请建议我的解决方案.
更新
**RolesPermission migration table**
Schema::create('roles', function(Blueprint $table){
$table->increments('id');
$table->string('name')->unique();
$table->string('label');
$table->string('description')->nullable();
$table->timestamps();
});
Schema::create('permissions', function(Blueprint $table){
$table->increments('id');
$table->string('name')->unique();
$table->string('label');
$table->string('description')->nullable();
$table->timestamps();
});
Schema::create('permission_role', function(Blueprint $table){
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('permission_id')
->references('id')
->on('permissions')
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
});
Schema::create('role_user', function(Blueprint $table){
$table->integer('role_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->primary(['role_id', 'user_id']);
});
.env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=W8YWZe3LCngvZzexH3WLWqCDlYRSufuy
DB_HOST=127.0.0.1 …Run Code Online (Sandbox Code Playgroud) 我的数组结构如下:
array(2) {
["uid"]=>
string(2) "39"
["name"]=>
string(18) "Manoj Kumar Sharma"
}
array(2) {
["uid"]=>
string(2) "47"
["name"]=>
string(11) "S kK Mishra"
}
Run Code Online (Sandbox Code Playgroud)
我想这些数组应该如下所示:
array(4) {
[39]=>
string(18) "Manoj Kumar Sharma"
[47]=>
string(11) "S kK Mishra"
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现这一目标?请帮我.
我在我的Production Server上遇到TokenMismatchException,但该应用程序在本地Xampp服务器和另一个托管上正常工作.它是我们的内部服务器,所以我们无法改变它.我们必须使用它,但我们不明白问题在哪里.
请朋友帮助我,我是否需要更改服务器中的任何内容,如插件,扩展程序或其他任何内容,请告诉我.这是下面的屏幕截图:
以上sceenshot来自Production和托管服务提供商之一.在生产服务器laravel应用程序上给出tokenmismatchexception,而相同的应用程序在另一个托管提供商上正常工作.我们不明白为什么会这样.请建议我们做什么.
更新:
我有新鲜的laravel 5.2并且php artisan make:auth在我获得777权限之后运行该文件夹,然后什么都不做.我仍然得到这个例外.
我想根据条件扩展模板.我知道我可以@if @else在刀片中使用语句.我正在做同样的事情,但刀片扩展了两个模板.我不知道为什么.
@if(isset(Auth::user()->id))
@extends('layouts.adminlayout')
@else
@extends('layouts.default')
@endif
@section('content')
i am the home page
{{ isset(Auth::user()->id) }}
@stop
Run Code Online (Sandbox Code Playgroud)
因为,您可以看到我正在检查用户是否登录,然后扩展模板布局.但它从两个布局都延伸出来.
请帮我.
我遇到了大问题,我在我的项目中保持雄辩的关系设置,我有以下关系:
努力
这是迁移和模型及其关系:
users migration table
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
User Model
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
* The attributes …Run Code Online (Sandbox Code Playgroud)