我想在 Voyager 的 User 类上添加一些修改器,但我不会更改 vendor 文件夹中的任何内容,并且 Voyages 在包中使用了 User 模型。我有可能以某种方式改变这一点吗?
我正在使用 Laravel 8.4(“laravel/framework”:“^8.40”)和 Voyager 1.4(“tcg/voyager”:“^1.4”)进行开发。
\n我在 Laravel Voyager 中遇到了一个不寻常的错误。当我为任何 BREAD 激活服务器端分页时,分页链接部分会中断,如下所示:
\n\n\n但是,当我关闭服务器端分页时,它们正在工作,如下所示:
\n\n\n我在浏览器控制台或其他地方没有收到任何错误消息。
\n虽然“<<上一个”和“下一个>>”按钮按预期工作,但它们没有样式。
\n我已经检查了特定部分的 HTML。链接存在于此处,但由于某种原因未在浏览器中正确显示。该部分的 HTML 如下:
\n<div class="pull-right">\n <nav role="navigation" aria-label="Pagination Navigation" class="flex items-center justify-between">\n <div class="flex justify-between flex-1 sm:hidden">\n <a href="http://tabapp.test/admin/departments?sort_order=desc&showSoftDeleted=0&page=1" class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">\n \xc2\xab Previous\n </a>\n \n <a href="http://tabapp.test/admin/departments?sort_order=desc&showSoftDeleted=0&page=3" class="relative inline-flex items-center px-4 py-2 …Run Code Online (Sandbox Code Playgroud)通过Voyager创建了新用户后,该头像显示为损坏的图像。我上传了新图像,但是图像仍然损坏。
我在Google Chrome浏览器中通过控制台进行了检查,发现3404错误:
2017-06-19 10:53:50.159 http:// localhost:8888 / storage / users / June2017 / ypKlbqbATDbpnYctZBFp.png 加载资源失败:服务器响应状态为404(未找到)
2017-06-19 10:53:50.256 http:// localhost:8888 / storage / users / June2017 / ypKlbqbATDbpnYctZBFp.png 加载资源失败:服务器响应状态为404(未找到)
2017-06-19 10:53:50.473 http:// localhost:8888 / vendor / tcg / voyager / assets / images / bg.jpg加载资源失败:服务器响应状态为404(未找到)查看该项目,这2个存储错误的路径为:http:// localhost:8888 / storage / app / public / users /和: http:// localhost:8888 / storage / app / public / users / June2017
在媒体中浏览文件夹时,我遇到类似的路径问题:
2017-06-19 11:38:22.248%7B%7B%20selected_file.path%20%7D%7D:1 GET http:// localhost:8888 / development / PhpstormProjects …
我从这里成功安装了 voyager admin
在我的客户端页面上,我创建了一个源自 auth 的自定义注册。我可以成功注册用户。
安装 voyager admin 后,我在客户的注册表单上添加了一个新用户。然后,当我尝试访问时,http://localhost:8000/admin出现错误,如图所示。
下面是第 53 行的图像:
下面是 VoyagerUse.php 的完整代码
<?php
namespace TCG\Voyager\Traits;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use TCG\Voyager\Facades\Voyager;
use TCG\Voyager\Models\Role;
/**
* @property \Illuminate\Database\Eloquent\Collection roles
*/
trait VoyagerUser
{
public function role()
{
return $this->belongsTo(Voyager::modelClass('Role'));
}
/**
* Check if User has a Role(s) associated.
*
* @param string|array $name The role to check.
*
* @return bool
*/
public function hasRole($name)
{
if (!$this->relationLoaded('role')) {
$this->load('role');
}
return in_array($this->role->name, (is_array($name) ? …Run Code Online (Sandbox Code Playgroud) 我已经在cPanel中上载了航海家管理面板。它给出了错误Missing storage symlink,并且未显示新添加项目的图像。
假设我要添加一个新用户。所有信息均显示为新用户接受用户头像。
在本地,可以通过运行cmd轻松修复错误php artisan storage:link。
但是在实时服务器中如何解决此错误?
我已经改变了storage driverin 的路径config/filesystems.php。将路径从更改storage_path()为public_path()
'public' => [
'driver' => 'local',
'root' => public_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
Run Code Online (Sandbox Code Playgroud) 如何在航海家中使用警报?有什么例子吗?我想在发布带有空字段的帖子时显示警报。
根据他们的指示,我正在尝试使用以下方法提取通过管理员上传的图像:
{{ Voyager::image( $brand->logo ) }}
Run Code Online (Sandbox Code Playgroud)
它没有获取 url,而是给了我一个附加了 JSON 项的 url:
http://job-tool.test/storage/[{"download_link":"brands\/April2018\/3Yrma1PZogiMiYOFmPGg.png","original_name":"logo_petiq.png"}]
Run Code Online (Sandbox Code Playgroud)
宠物智商
运行只是{{ $brand->logo }}给了我没有前置 url 的数组。我在这里缺少什么?
我也试图只使用这个:{{ Voyager::image( $brand->logo->download_link ) }}但我收到这个错误:
Trying to get property 'download_link' of non-object (View: /Users/johnbriggs/Code/Laravel/job-tool/resources/views/brands/show.blade.php)
Run Code Online (Sandbox Code Playgroud) 我有两个表-医生和部门以及它们之间的关系doctor_has_department。
我想添加一个布尔值 isBoss 列,但我不知道如何更改其中的值并在 laravel 中引用它。
我想做一个复选框,如果选中它会将值更改为 1。
我正在使用 voyager 为我的网络应用程序创建管理面板:当我尝试创建具有 ownToMany 关系的数据透视表时。
我收到此错误消息:
SQLSTATE[42S22]:未找到列:1054“where 子句”中的未知列“tour_category.tour_category_id”(SQL:从. = .上的内部联接中选择
tours. ,其中.为空)。我是使用 Voyager 的新手。有没有人可以帮助我修复这个错误?idtourstour_categorytoursidtour_categorytour_idtour_categorytour_category_id
我是 laravel 的新手,正在尝试 voyager 管理面板。我在 voyager 中添加了一个自定义按钮来为每个订单分配一个供应商。当管理员点击自定义按钮时,它应该向那个新页面发送一个订单 ID。我试图发送一个值,但它不起作用。
任何帮助表示赞赏。
namespace App\Actions;
use TCG\Voyager\Actions\AbstractAction;
class MyAction extends AbstractAction
{
public function getTitle()
{
return 'Assign to vendor';
}
public function getIcon()
{
return 'voyager-eye';
}
public function getPolicy()
{
return 'read';
}
public function getAttributes()
{
return [
'class' => 'btn btn-sm btn-primary pull-right',
];
}
public function shouldActionDisplayOnDataType()
{
return $this->dataType->slug == 'orders';
}
public function getDefaultRoute()
{
return route('vendors');
}
}
Run Code Online (Sandbox Code Playgroud) 我在 Godaddy.com(共享主机)上使用 installatron 创建了一个 Laravel 应用程序。安装 Voyager 后,默认管理员头像未显示。存储链接由 Voyager 自动创建。但是当我打开管理面板时,voyager尝试从[app_url]/storage/users/default.png获取管理员头像并收到 404。头像位于[app_url]/public/storage/users/default.png
版本: Laravel:5.8 Voyager:1.3
我使用的是Voyager,我想解决,如果用户是admin,请在欢迎页面中查看另一个菜单项。
预先感谢您的回答!
<body>
<div class="flex-center position-ref full-height">
@if (Route::has('login'))
<div class="top-right links">
@auth
<a href="{{ url('/home') }}">Home</a>
@else
<a href="{{ route('login') }}">Login</a>
<a href="{{ route('register') }}">Register</a>
@endauth
</div>
@endif
<div class="content">
<div class="title m-b-md">
Laravel
</div>
<div class="links">
<a href="https://laravel.com/docs">Documentation</a>
<a href="https://laracasts.com">Laracasts</a>
<a href="https://laravel-news.com">News</a>
<a href="https://forge.laravel.com">Forge</a>
<a href="https://github.com/laravel/laravel">GitHub</a>
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud) 大家,我需要将图像名称保存在数据库的头像列中,并将图像保存在 public/Storage/users 我的代码这里 将图像链接保存在数据库中,请帮忙。
public function handleProviderCallback($service)
{
$user = Socialite::driver($service)->user();
$FindUser = User::where('email',$user->getEmail())->first();
if($FindUser){
Auth::login($FindUser);
}
else{
$NewUser = new User;
$NewUser->email = $user->getEmail();
$NewUser->name = $user->getName();
$NewUser->avatar = $user->getAvatar();
$NewUser->password = bcrypt(123456);
$NewUser->save();
Auth::login($NewUser);
}
return redirect('/');
}
Run Code Online (Sandbox Code Playgroud) voyager ×13
laravel ×12
php ×4
laravel-5 ×2
admin ×1
blade ×1
cpanel ×1
laravel-5.4 ×1
pagination ×1
roles ×1
server-side ×1
sql ×1