小编Sri*_*opi的帖子

Laravel Botman工作室

我已经在我现有的laravel项目上安装了botman studio来创建一个聊天机器人.聊天机器人工作.但是,我正在寻找复杂的对话,用户可以在其中询问聊天机器人"什么是示例"和聊天框从数据库表中搜索并回答.

我找不到任何可以帮助我入门的教程或链接.有谁知道如何做到这一点?一个简单的例子可以帮助我

laravel-5

8
推荐指数
1
解决办法
379
查看次数

Laravel 5.6图像上传,将文章slug保存为数据库中的图像名称

我正在使用Laravel 5.6和Collective HTML.

我有一个表格文章,我正在创建一个表单来上传一篇文章

ArticleController

/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create()
{
    $categories = ArticleCategory::pluck('name', 'id');
    return view('backend.articles.create', compact('categories'));
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    $this->validate($request, [
      'input_img' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
    ]);

    $article = new Article();

    if ($request->hasFile('image')) {
        $image = $request->file('image');
        $name = str_slug($request->title).'.'.$image->getClientOriginalExtension();
        $destinationPath = public_path('/uploads/articles');
        $imagePath = destinationPath. …
Run Code Online (Sandbox Code Playgroud)

php image-uploading laravel

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

在引导程序4中将页脚刷新到页面底部

我正在使用bootstrap 4

我有这样的模板结构

<div id="app">
  <div id="content">
    <nav id="content-header">
    ...code here...
    </nav>
    <main id="content-main">
    ...code here...
    </main>
    <div id="footer">
    ...code here...
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

但是,页脚不会像预期的那样冲到底部.(我不是在寻找粘性页脚).如何使用代码im向下发送页脚.

几周前我读了一篇文章,我们需要相应地使用id ="content"和content-header content-footer来进行引导,以使这项工作成功.我丢失了文章链接,因此在这里发布了一个问题.

任何帮助表示赞赏

bootstrap-4

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

Laravel - 用用户名,电子邮件或电话登录

我在现有项目中使用用户名或电子邮件实现了登录,并且工作正常.我想将其扩展为使用用户名,电子邮件或电话登录.我希望用户使用用户名,电子邮件或电话号码和密码登录.

这是我的代码App\Http\Controllers\Auth\LoginController

<?php

namespace App\Http\Controllers\Auth;
use Socialite;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create …
Run Code Online (Sandbox Code Playgroud)

php login laravel

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

数据库中的计算字段-Laravel

在数据库中存储计算字段的最佳实践是什么。

例如,假设一张桌子有高度,重量,体重指数等字段

用户输入身高体重值,并自动填写bmi字段。如何用表格实现。

bmi $ bmi的公式=体重/(身高*身高)

尝试了以下配置文件模型

protected $table = 'profiles';

protected $fillable = ['user_id', 'weight', 'height', 'dob', 'age', 'bmi'];

public function user(){
  return $this->belongsTo(User::class, 'user_id');
}

protected static function boot() {
  parent::boot();

  static::saving(function($model){
      $model->bmi = $model->weight / ($model->height * $model->height);
      $model->age = (date('Y') - date('Y',strtotime($model->dob)));
  });
}
Run Code Online (Sandbox Code Playgroud)

配置文件控制器

public function store(Request $request)
  {
      $profile = new Profile();
      $profile->weight = $request->get('weight');
      $profile->height = $request->get('height');
      $profile->dob = $request->get('dob');
      $profile->age;
      $profile->bmi;
      $profile->save();
      return back()->with('success', 'Your profile has been updated.');
  }
Run Code Online (Sandbox Code Playgroud)

但是我收到一个错误

Illuminate …
Run Code Online (Sandbox Code Playgroud)

laravel

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

标签 统计

laravel ×3

php ×2

bootstrap-4 ×1

image-uploading ×1

laravel-5 ×1

login ×1