小编Mad*_*tel的帖子

如何在 Laravel 中使用同一个 Blade 模板来添加和编辑一个控制器?

我有一个问题,我使用相同的刀片模板来创建和插入。在我的控制器中,我在编辑功能和我使用的方法模板上创建了一个变量 ModificationMode isset()

控制器

public function edit($id)
{
    $ModificationMode = 0;
    $DataPraticien = \App\Praticien::find($id);

    return view('AjoutePraticien', compact('DataPraticien'))->with('ModificationMode', $ModificationMode);
}
Run Code Online (Sandbox Code Playgroud)

看法

@if(isset($ModificationMode))

<form method="post" action="{{route('prat.update', $DataPraticien ?? '')}}">
@csrf
@method('PATCH')
    @else
    <form action="{{route('prat.store')}}" method="post">
        @endif
//stuff
//stuff
Run Code Online (Sandbox Code Playgroud)

我将每个变量设为可选。这是一个好主意吗?这种方法会给我带来一些问题吗?安全怎么样?

php crud laravel laravel-blade

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

如何在 Dompdf laravel 5.5 中使用分页符?

我在设计系统的 pdf 时遇到问题。这是我的 pdf 图片:

PDF文件

我想要做的是将表中的项目数量限制为 10 个项目,然后其余的项目进入下一页,其中的页眉和页脚已修复。就像这样: 购买请求 PDF

这是我的代码:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>PDF</title>

    <link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
    <style>
        #items tr{border:1px solid #000000;}
        #items tbody tr td{border:1px solid #000000;}
        #items thead td{background-color:#231F20;color:#FFFFFF;}

        .header { position: fixed; left: 0px; top: -40px; right: 0px;}
        .footer { position: fixed; left: 0px; bottom: 200px; right: 0px;}
    </style>
    <link rel="stylesheet" href="{{ asset('css/lato.css') }}">
    <link href="https://fonts.googleapis.com/css?family=Libre+Barcode+128" rel="stylesheet">



</head>
<body>
<div class="container-fluid">

<div class="header">
    <div class="row">

        <div class="col-xs-3" style="font-family: 'Libre …
Run Code Online (Sandbox Code Playgroud)

css php dompdf laravel laravel-5.5

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

在 laravel 5.6 中重置密码时从所有浏览器注销用户

当用户更改他们的密码时,他们会从浏览器中注销。但是,如果他们同时登录到另一个浏览器,则他们会在另一个浏览器上保持登录状态。

我想在用户重置密码时从他们登录的所有浏览器中注销用户。

这里登录控制器。

function checklogin(Request $request)
{

    $this->validate($request, ['email' => 'required|email', 'password' => 'required|string|min:3']);

    $user_data = array(
        'email' => $request->get('email') ,
        'password' => $request->get('password')
    );

    $remember_me = $request->has('remember') ? true : false;

    if (Auth::attempt($user_data, $remember_me))
    {
        return redirect()->intended('dashboard');
    }
    else
    {
        return back()->with('error', 'Wrong Login Details');
    }
}
Run Code Online (Sandbox Code Playgroud)

发送邮件功能如下

function sendEmail(Request $request)
{

    $this->validate($request, ['email' => 'required|exists:users']);

    $email = $request->email;

    $name = User::where('email', $email)->first();
    $name = $name->name;

    $token = Password::getRepository()->createNewToken();
    $link = url("password/reset?email=$email&token=$token");

    $value = Password_resets::where('email', $email)->first();

    if (isset($value))
    { …
Run Code Online (Sandbox Code Playgroud)

php authentication reset-password laravel-5.6

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

如何在移动视图中删除网站右侧的多余空白

https://comcube.ae/index.html

在移动设备上查看时,我在此网站中获得了一个完整的垂直空白区域。(在 Google Chrome 浏览器中)我试过了margin: autowidth: 100%;那种事情......但仍然不正确。问题出在索引页上。任何帮助表示赞赏。谢谢你。

html css media-queries responsive-design

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