/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
if ($exception instanceof MethodNotAllowedHttpException) {
if ($request->ajax()) {
return response()->json(['error' => 'method invaild.'], 404);
}
abort(404);
}
return parent::render($request, $exception);
}
php artisan queue:work
что бы выполнялись очереди public function handle(Mailer $mailer)
{
$mailer->send('email.welcome', ['data'=>'data'], function ($message) {
$message->from('nwambachristian@gmail.com', 'Christian Nwmaba');
$message->to('nwambachristian@gmail.com');
});
}
Job classes are very simple, normally containing only a handle method which is called when the job is processed by the queue.
Job classes очень просты, как правило , содержащие лишь handle метод , который вызывается , когда задание обрабатывается очереди.
public function showCategory(Request $request, $id)
{
$recipes = Tag::find($id)->recipes()->where('public', '=', 1)->get();
$tags = Tag::with('recipes')->get();
if ($request->ajax()) {
return view('site.recipe_load', ['recipes' => $recipes])->render();
}
return view('site.recipe_load', ['recipes' => $recipes]);
}
public function authenticate(Request $request)
{
$name = $request->input('name');
$password = $request->input('password');
$user = User::where('name', $name)->first();
if (Hash::check($password, $user->password))
{
return 'nice';
}
else
{
return 'Ошибка! Введенный пароль не совпадает с текущим!';
}
}
<select name="city">
@foreach ($testimonies as $testimony)
<option>{{$testimony->town}}</option>
@endforeach
</select>
public function index(Request $request){
$city = $request->get('city');
$testimony = Testimony::where('city','LIKE',$city)->orderBy('id', 'desc')
->get();
return view('welcome', [
'testimonies' => $testimony
]);
}