laravel-5.2

TokenMismatchException in VerifyCsrfToken.php line 67 on laravel using ajax

假装没事ソ 提交于 2019-12-22 09:37:30
问题 This view has a link which calls a javascript function @extends('layouts.main') @section('content') <table class="table"> <tr> <th>ID</th> <th>Nombre</th> <th>Opción</th> </tr> @foreach ($tasks as $task) <tr> <td>{{$task->id}}</td> <td>{{$task->name}}</td> <td><a href="javascript:void(0)" onclick="eliminar({{$task->id}})" class="btn btn-danger">Eliminar</a></td> </tr> @endforeach </table> @stop and here is the javascript code function eliminar(id){ $.ajax({ type: "DELETE", url: "task/"+id,

how to use delete method in route in laravel 5.2

依然范特西╮ 提交于 2019-12-22 08:44:37
问题 I want to use delete route in my laravel project. like and want to send route from href of a anchor tag. is it possible to use delete method in route from "href" of anchor tag Route::delete('/news/{id}', 'NewsController@destroy'); 回答1: You can't use anchor tag with href to send the request to delete. You need a form todo so. With a method DELETE since in form we have only get and post so create a hidden field with name _method and value DELETE Create form similar to this : <form action="news

How to include a blade file which has a full stop (.) as part of the file name in blade

随声附和 提交于 2019-12-22 08:42:11
问题 I have a partial view with the following path. /views/acp/review/check.details.blade.php How do I include such a file using blade because If I do @include('views.acp.review.check.details') I get an error because It attempts to parse check.details as check/details Please how can I include the file having the full stop? Edit: I don't want to Rename the file 回答1: Blade uses the . as directory separators and you probably don't want to change that :) Rename the file to: /views/acp/review/check

How to include a blade file which has a full stop (.) as part of the file name in blade

↘锁芯ラ 提交于 2019-12-22 08:40:06
问题 I have a partial view with the following path. /views/acp/review/check.details.blade.php How do I include such a file using blade because If I do @include('views.acp.review.check.details') I get an error because It attempts to parse check.details as check/details Please how can I include the file having the full stop? Edit: I don't want to Rename the file 回答1: Blade uses the . as directory separators and you probably don't want to change that :) Rename the file to: /views/acp/review/check

How to create symlink from public/storage to storage/app/public in laravel?

旧街凉风 提交于 2019-12-22 08:26:26
问题 I have no idea on how to create symbolic link or symlink . I am working on File system in laravel 5.2. The document says that i need to create a symbolic link from public/storage to storage/app/public to keep the publicly accessible files in one directory. How to create that symlink or symbolic link? Which file or directory should I place that code? 回答1: App::make('files')->link(storage_path('app/public'), public_path('storage')); And don't forget to use App after namespace. 回答2: Run this

Using a Laravel model method in an Eloquent query

天大地大妈咪最大 提交于 2019-12-22 07:09:02
问题 This is for Laravel 5.2. I have a method defined as follows in my Users model: public function name() { return "$this->name_first $this->name_last"; } I'm trying to figure out how to use that as part of a query, but it seems like it isn't possible for a somewhat obvious reason: the database doesn't know anything about the method and that makes perfect sense. However, the concept of what I'm trying to achieve makes sense in certain contexts, so I'm trying to see if there's a way to accomplish

Can't load a Non-Laravel Composer package

孤街浪徒 提交于 2019-12-22 05:22:36
问题 It's the first time that I try to load a Composer package that doesn't use a Laravel service provider or a facade. I am trying to install this package: https://github.com/mollie/mollie-api-php I have followed the steps to install the package with Composer. At the top of my controller I added: require_once base_path('vendor/Mollie/API/Client.php'); I get the following error: main(): Failed opening required '../vendor/Mollie/API/Client.php' (include_path='.:/Applications/MAMP/bin/php/php7.0.0

How to get the queued job from job ID in Laravel?

故事扮演 提交于 2019-12-21 17:36:19
问题 Is there any way to get the queued job from the job ID in Laravel? While adding the job to the queue, I store the job ID. Later at some point of time (there is a delay to process the job in the queue), I want to remove the job from the queue. If I can get the job on the queue using the job ID, I can use delete() method to remove it. 回答1: I use this code for laravel 5.5 : use Illuminate\Contracts\Bus\Dispatcher; $job = ( new JOB_CLASS() )->onQueue('QUEUE_NAME')->delay('DELAY'); $id = app

Extending Laravel 5.2 SessionGuard

狂风中的少年 提交于 2019-12-21 12:21:58
问题 I want to extend the Laravel stock authentication to use an OAuth server for user retrieval and authentication while taking advantage of the existing functionality. I already managed to extend the EloquentUserProvider to partially overwrite/extend the implementations of the Illuminate\Contracts\Auth\UserProvider contract. The current implementation looks like this: class EloquentOauthServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return

Add a new transport driver to Laravel's Mailer

僤鯓⒐⒋嵵緔 提交于 2019-12-21 06:25:55
问题 I need to add a new transport driver to Laravel's mail package so that I can send e-mails through an external service (Mailjet) that isn't supported by default. Writing the transport driver won't be a problem, but I can't find a way to hook in and add a new one so I can continue to use Laravel's mailer as normal. I can't find any documentation on extending the Mailer. The only way I can come up with would be to replace where Laravel's MailServiceProvider is being referenced in config/app.php