我已经在 Mac Finder 中重新组织了我的存储库的文件夹结构,现在当我打开 Git Tower 时,它通知我无法找到这些存储库。我明白这一点,但是我试图弄清楚如何从应用程序内部更新存储库的位置。我查看了 Tower 网站并使用 Google 进行了研究,但是我还没有提出任何可能的解决方案。
有没有人有什么建议?
我正在我的本地开发服务器上使用MAMP在我的laravel应用程序上,我正在试图弄清楚如何安全地设置我的服务器,所以我不必将以下内容用于数据库连接mysql数组,因为这应该只当我在我的开发服务器上时使用.当我将行添加到mysql数组中时,它会起作用,但是如果我在生产服务器上则不会使用它.有任何想法吗?
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
Run Code Online (Sandbox Code Playgroud)
.env.development.php
<?php
return [
'DB_HOST' => '127.0.0.1',
'DB_USERNAME' => 'root',
'DB_PASSWORD' => '1234',
'DB_NAME' => 'mytable'
];
Run Code Online (Sandbox Code Playgroud)
应用程序/配置/ database.php中
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USERNAME'),
'password' => getenv('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
Run Code Online (Sandbox Code Playgroud) 我最初在Laravel 4.2中开发我的应用程序,但后来决定将其移至5.0版本,以便它涵盖了5.0超过4.2的更多变化和优势.
我试图运行我的migratiosn然而我收到错误:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
Run Code Online (Sandbox Code Playgroud)
我调查了这个,并注意到它是怎么回事,因为我正在为我的服务器而不是流浪汉和宅基地运行MAMP.我并没有敲开那两个人的用途,但我在这一点上对MAMP感觉更舒服,直到它让我失望.我知道它的MAMP的原因是因为需要声明要使用的unix socket值.
现在,在我的4.2版本的应用程序中,我有以下内容:
'mysql' => array(
'driver' => 'mysql',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'host' => getenv('DB_HOST'),
...
),
Run Code Online (Sandbox Code Playgroud)
使用我的Laravel 5.0版本,我正在使用.env文件作为我的环境变量,并且不确定我需要如何执行此操作以便它知道使用unix套接字值.
罐头有人告诉我如何将其应用到新版本或更好的方式将其添加到设置中,以便我不必这样做?
我在他的网站上跟随Jeffrey Ways laracasts一直在学习,但不幸的是我在某个地方犯了错误,我不知道那是哪里.我收到以下错误.
https://laracasts.com/series/laravel-from-scratch
Symfony \ Component \ Debug \ Exception \ FatalErrorException
syntax error, unexpected '__data' (T_STRING)
<?php $__env->startSection('content'); ?>
<h1>All Users</h1>
<?php foreach($users as $user): ?>
<li><?php echo link_to("/users/{$user->username}", $user->username); ?></li>
<?php endforeach; ?>;
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.default, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Run Code Online (Sandbox Code Playgroud)
我不太清楚为什么我会遇到这个问题.有人可以向我解释一下,所以我能理解吗?
我正在尝试使用Laravel Storage Facade将文件上传到临时位置,并且它说该文件不存在.我正在尝试将文件上传到./storage/app/roofing/projects/{id}/then文件.不知道我到底哪里错了.
foreach ($files as $file) {
$path = Storage::putFile('contract-assets', new File('../storage/app/roofing/projects/'. $project->id.'/'. $file));
}
Run Code Online (Sandbox Code Playgroud)
我必须在将文件存储在我的本地服务器上之后将文件发送到AWS S3,因为尝试直接上传到S3需要一些时间,在我的情况下,由于需要存储的文件数量,它需要时间.截至目前,我所有的回复在我的dd()中都是正确的.可能是什么原因造成的?
if (!empty($request->contract_asset)) {
$files = $request->file('contract_asset');
foreach ($files as $file) {
Storage::putFile(Carbon::now()->toDateString().'/roofing/projects/'. $project->id.'/contract-assets', $file);
}
}
foreach (Storage::files(Carbon::now()->toDateString().'/roofing/projects/'.$project->id.'/contract-assets') as $file) {
dispatch(new ProcessRoofingProjectContractAssets($file, $project));
}
Run Code Online (Sandbox Code Playgroud)
我的工作档案.
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$path = Storage::disk('s3')->put('contract-assets', $this->asset, 'public');
dd($path);
$this->project->addContractAsset($path);
}
Run Code Online (Sandbox Code Playgroud)
更新:
这些是我当前的更改,我收到以下错误消息. Failed because Unable to JSON encode payload. Error code: 5
foreach ($files …Run Code Online (Sandbox Code Playgroud) 我尝试从Vagrant更新我的Homestead框并收到404错误消息,我做了一些搜索,但不知道为什么我可以更新它的问题是什么.
? Homestead git:(master) ? vagrant box update
==> default: Checking for updates to 'laravel/homestead'
default: Latest installed version: 2.0.0
default: Version constraints: >= 0
default: Provider: virtualbox
There was an error while downloading the metadata for this box.
The error message is shown below:
The requested URL returned error: 404 Not Found
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Carbon 检索自过去特定日期以来的所有星期一和星期二以及每个月的最后一个星期日。然后我想遍历天数数组并为那一天创建一个偶数。我想弄清楚如何做到这一点?
// Get all dates of Mondays, Tuesdays, last Sundays of every Month since the first Monday of January of 2000.
$eventDates = Carbon::parse('first Monday of January 2000');
$i = 0;
while($eventDates->lt(Carbon::now()->subDay(14))) {
$event = factory(Event::class)->create([
'date' => $eventDate,
]);
}
Run Code Online (Sandbox Code Playgroud) 我运行了以下测试,我收到一个failed_asserting,表示false为true.有人可以进一步解释为什么会这样吗?
/** @test */
public function a_user_logs_in()
{
$user = factory(App\User::class)->create(['email' => 'john@example.com', 'password' => bcrypt('testpass123')]);
$this->visit(route('login'));
$this->type($user->email, 'email');
$this->type($user->password, 'password');
$this->press('Login');
$this->assertTrue(Auth::check());
$this->seePageIs(route('dashboard'));
}
Run Code Online (Sandbox Code Playgroud) 我试图弄清楚为什么我的 ApiException 仍然返回文本/html 响应而不是 ApiException 渲染方法中表示的 json 响应。它给了我正确的错误消息,但它没有将它呈现为 json。
/**
* Get the checklist (depending on type - send from Vue model)
*/
public function fetchChecklist(Request $request)
{
$id = $request->input('projectId');
$type = $request->input('type');
if (empty($id)) {
throw new ApiException('Project was not provided.');
}
if (! $project = RoofingProject::find($id)) {
throw new ApiException('Project not found.');
}
if (empty($type)) {
throw new ApiException('No checklist type was provided.');
}
switch ($request->input('type')) {
case 'permitting':
$items = $project->permittingChecklist;
break;
case 'permit':
$items = …Run Code Online (Sandbox Code Playgroud) 我有以下 foreach 循环,我得到了很好的结果,但是当它到达 elseif 语句时,我试图查看两个球员是否在同一支球队中,如果他们被分开列出带有 & 符号。目前我仍然收到以下信息。
Player 1 vs. Player 2 vs. Player 3 vs. Player 4
Run Code Online (Sandbox Code Playgroud)
这没关系,但是玩家 1 和玩家 2 在同一支球队。因此,出于某种原因,它没有将他们视为同一支球队。有人看到我的问题是什么吗?
@foreach ($match->players AS $key => $player)
@foreach ($player->list as $member)
{{ $member->player_name }}
@endforeach
@if($match->players->count() - 1 != $key)
vs.
@elseif ($match->players[$key - 1]->team_id == $player->team_id)
&
@endif
@endforeach
Run Code Online (Sandbox Code Playgroud)
编辑:我稍微更改了数据,但仍然可以工作。
http://pastebin.com/AdyzemC4
Run Code Online (Sandbox Code Playgroud) laravel ×8
php ×6
laravel-5 ×5
mamp-pro ×2
blade ×1
git ×1
git-tower ×1
homestead ×1
laravel-4 ×1
mamp ×1
mysql ×1
php-carbon ×1
unit-testing ×1
unix-socket ×1
vagrant ×1