我有一个托管在 DigitalOcean NGINX 服务器上的生产 Laravel 网站,每次 git 推送新更新时,我总是运行以下命令:
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear
composer dump-autoload
Run Code Online (Sandbox Code Playgroud)
这是一个好的做法,还是在我的服务器上运行这些命令会导致问题?
我使用php artisan命令但看到此错误。
此错误显示在所有 artisan 命令中
Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Reque
st, null given, called in E:\appoo\vendor\laravel\framework\src\Illuminate\Routing\RoutingServiceProvider.php
on line 65
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
如何使用 Laravel Artisan Tinker 编写两行命令?
User::whereEmail('john.doe@home.com')
->get()
Run Code Online (Sandbox Code Playgroud)
PHP 解析错误:语法错误,第 1 行出现意外的 T_OBJECT_OPERATOR
当我尝试使用“php artisan migrate”命令在 Laravel 5 中迁移表时出现以下错误:
'SQLSTATE[HY000] [2002] 中没有这样的文件或目录'。. . /vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47
我的 .env 文件包括如下默认设置:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Run Code Online (Sandbox Code Playgroud)
我的database.php文件将mysql列为默认的数据库连接,homestead在我的homestead.yaml文件中列为数据库,homestead是我访问mysql并使用show databases;命令时列出的表之一。
关于我可能做错了什么的任何想法?
我创建了一个 laravel 任务并添加到我的 crontab 文件中
应用程序/控制台/Kernel.php
<?php
namespace App\Console;
use Carbon;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\Inspire::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$now = Carbon\Carbon::now('America/New_York');
$dt = Carbon\Carbon::parse($now);
$time_start = $dt->toTimeString();
$dt = str_replace('-','_',$dt);
$dt = str_replace(' ','_',$dt);
$dt …Run Code Online (Sandbox Code Playgroud) 我运行了一个命令php artisan view:clear,因为我按照有关 Laravel 中自定义 404 页面的教程进行了操作,并且如上所述,该命令清除了所有已编译的视图文件,然后我在 Laravel 文档中进一步查找,它说它从视图文件中删除了缓存。我问这个的原因是因为
我来自委内瑞拉,我在尝试将 Laravel echo 与项目集成时遇到问题,我尝试了一切,我想得到你的帮助。
也许我没有以正确的方式工作。
我正在尝试将广播事件与 socket io 一起使用,因为我在一家初创公司工作,并且很难支付像 pusher 这样的服务。
我正在尝试进行简单的实时聊天。
那是我的 chatController ..
public function index(Request $request){
$sender=Auth::user()->id;
$receiver=\App\User::find(2);
$message=new Message;
$message->message="Hola, esto es una prueba de eventos";
$message->user_receiver_id=$receiver->id;
$message->user_sender_id=Auth::user()->id;
$message->id_chat=1;
$message->save();
event(new \App\Events\sendMessage($message,$receiver));
return response()->json(["status"=>"ok"]);
}
Run Code Online (Sandbox Code Playgroud)
该聊天根据确定的组(聊天)将消息存储在数据库中。
将被触发的事件是:
类 sendMessage 实现 ShouldBroadcast { 使用 Dispatchable、InteractsWithSockets、SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public $message;
public $user_receiver;
public function __construct(Message $message,User $user_receiver)
{
$this->message=$message;
$this->user_receiver=$user_receiver;
}
public function broadcastOn()
{
\Log::info($this->message->id_chat);
return new …Run Code Online (Sandbox Code Playgroud) 如何在托管在网络中的应用程序中运行这些工匠命令?我的 cpanel 中是否有一个 cmd 可以执行这些命令?提前致谢。
我正在使用 laravel 5.6 并遇到问题,当我在控制台中使用命令“php artisan vendor:publish”时,出现以下错误:
[ERROR] Use of undefined constant STDIN - assumed 'STDIN'
Which provider or tag's files would you like to publish?
[0] Publish files from all providers and tags listed below
[1] Provider: Intervention\Image\ImageServiceProviderLaravel5
Run Code Online (Sandbox Code Playgroud)
问题是,这些消息似乎是无限的,直到我关闭控制台或长时间后它会终止进程。
我在 google 上查找了这个问题,但只发现了 stdin 的问题,不同之处在于,遇到这个问题的人没有在命令行界面中调用 artisan,而是直接在 php 脚本中调用。
当我使用“php artisan migrate”时出现同样的问题
我正在使用 Laravel 的一个现有项目,这个现有项目已经有模型,这是一个例子:
<?php
/**
* Created by Reliese Model.
* Date: Fri, 20 Apr 2018 08:56:36 +0000.
*/
namespace App\Models;
use Reliese\Database\Eloquent\Model as Eloquent;
/**
* Class PdTcountry
*
* @property int $pkcountry
* @property string $country_code
* @property string $country_name
* @property string $country_localName
* @property string $country_webCode
* @property string $country_region
* @property string $country_continent
* @property float $country_latitude
* @property float $country_longitude
* @property string $country_surfaceArea
* @property string $country_population
* @property string $country_postcodeexpression
* @property …Run Code Online (Sandbox Code Playgroud) laravel ×10
laravel-artisan ×10
php ×8
composer-php ×1
cpanel ×1
cron ×1
homestead ×1
jquery ×1
laravel-5 ×1
laravel-echo ×1
mysql ×1
server ×1
stdin ×1
tinker ×1
view ×1