我需要显示基于数据库值检查的单选按钮,如果我更改单选按钮的选择并显示在表单上,则更新该值。
<label class="radio-inline">
<input type="radio" id="option1" name="status" value="{{ old('is_active', $site->is_active) }}" name="status" >OFF</label>
<label class="radio-inline">
<input type="radio" id="option2" name="status" value="{{ old('is_active', $site->is_active) }}" name="status">ON</label>
Run Code Online (Sandbox Code Playgroud)
这是在我的控制器里面
$site->update([
'name'=>$request['name'],
'copyright'=> $request['copyright'],
'is_active'=>$request['status'] == 'true' ? 1 : 0,
'message'=>$request['message'],
'datatime'=>date('Y-m-d', strtotime($request['datatime'])),
'url'=>$request['url'],
'metadata'=>$request['metadata']
]);
Run Code Online (Sandbox Code Playgroud) 我正在使用laravel 5.4我得到了错误
HasRelationships.php第487行中的FatalThrowableError:未找到"用户"类
在我的模型中,我使用以下代码
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Auth;
use App\User;
class Review extends Model
{
public function user()
{
return $this->belongsTo('User');
}
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个错误
我的产品控制器:
public function category(Request $request, $name, $main){
if($request->data){
$explode_id = array_map('intval', explode(',', $request->data));
$category_id = Category::where('name', $name)->value('id');
if($category_id == "")
{
$all_categories_id = Category::pluck('id');
}
else
{
$all_categories_id = Category::where('parent_id', $category_id)->pluck('id');
$all_categories_id->push($category_id);
}
$product_id = Product::where('name', 'like','%'.$main.'%')->whereIn('id', $explode_id)->pluck('id');
$id = ProductCategory::whereIn('product_id', $product_id)->whereIn('category_id', $all_categories_id)->pluck('id');
$products = Product::find($id);
}
else{
$category_id = Category::where('name', $name)->value('id');
if($category_id == "")
{
$all_categories_id = Category::pluck('id');
}
else
{
$all_categories_id = Category::where('parent_id', $category_id)->pluck('id');
$all_categories_id->push($category_id);
}
$product_id = Product::where('name', 'like','%'.$main.'%')->pluck('id');
$id = ProductCategory::whereIn('product_id', $product_id)->whereIn('category_id', $all_categories_id)->pluck('id');
$products = Product::find($id); …Run Code Online (Sandbox Code Playgroud) 我正在使用laravel 5.4和auth进行登录,注册,密码重置功能,当我尝试重置密码时,一切正常,它发送电子邮件并更改密码,效果很好..更改新密码后,它将我重定向到首页,并且自动登录,但是我想要的是更改密码后将我重定向到登录页面,以便使用人员可以检查更改后的密码是否正常工作。
所以我的问题如何实现这个???
而我的ResetPasswordController是
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo …Run Code Online (Sandbox Code Playgroud)