laravel-5.2

Laravel 5.2 - Method links does not exist

浪子不回头ぞ 提交于 2020-01-14 19:37:25
问题 i'm passing my array $posts to my view and i'm tryng use pagination but i have the error: Method links does not exist. (View: C:\xampp\htdocs\app\resources\views\search.blade.php) CONTROLLER $posts = Post::where('visible', 1) ->where('expire_date', '>', $current)->where('delete', 0); $posts->paginate(1); $posts = $posts->get(); return view('search', compact('posts')); VIEW <div class="pagination-bar text-center"> {{ $posts->links() }} </div> 回答1: Change you code to this: $posts = Post::where(

Laravel Job - No handler registered for command

半城伤御伤魂 提交于 2020-01-14 19:05:00
问题 I tried to get a simple job running exactly like the example in the Laravel Documentation - https://laravel.com/docs/5.2/queues#writing-job-classes - but I get this error: "No handler registered for command [App\Jobs\SendReminderEmail]". I followed the instructions to make the jobs table and even the failed_jobs table and have the exact example code. I assured that the handle() function is there so I don't know what else can be missing. Regards. Update with code : First I used the class in

Jwt with multiple model

扶醉桌前 提交于 2020-01-14 07:58:30
问题 I use Lavarel 5.2 framework with jwt for authorization jwt takes user info form token just with one model, now how can i parse user token with jwt on multiple model? For sample when i use customer token in a api jwt parse that token from customer model , default guard should be customer auth.php : 'defaults' => [ 'guard' => 'operator', 'passwords' => 'operators', ], 'guards' => [ 'operator' => [ 'driver' => 'session', 'provider' => 'operators', ], 'customer' => [ 'driver' => 'session',

Laravel Auth count user login

非 Y 不嫁゛ 提交于 2020-01-14 06:18:05
问题 I installed Laravel with the Laravel/Auth. How can i count how often a user logged in his account? I tried to find the updated_at function to add a increment command to push up the count. 回答1: You can use events to accomplish it. More information about events can be found on Laravel documentation You should add a new property loginCount to the User model and its correspondent in db. Make sure that on creation the loginCount field has the default value set to 0 . To increment it when user is

Sweetalert package and jQuery submit() not working correctly

北城以北 提交于 2020-01-14 03:52:10
问题 Using sweetalert library. Here's my form: <form id="delete-currency" style="display:inline;" method="POST" action="/admin/currency/7"> <input type="hidden" name="_token" value="sIgpTKlPJ4Z3Co4daRwGpZ8rz10TCM6Ynre8sdsdsd"> <input type="hidden" name="_method" value="DELETE"> <button type="button" class="btn btn-danger btn-delete"><i class="fa fa-trash-o" aria-hidden="true"></i></button> </form> 7 - is an item id. Then i am using confirm window (sweetalert): <script type="text/javascript"> $('

Best design practice to implement routes and controllers for a RESTFul Laravel app

烈酒焚心 提交于 2020-01-13 13:05:03
问题 I am developing an application with Laravel 5.2, it has to be implemented RESTFUL. It is also very easy to implement RESTful resources in Laravel. for example for getting all categories in json format in routes we just have to add Route::resource('category', 'CategoryController'); and then in the CategoryController we are going to have this for returning a JSON object of all categories: class CategoryController extends Controller public function index() { $categories = Category::all(); return

Best design practice to implement routes and controllers for a RESTFul Laravel app

℡╲_俬逩灬. 提交于 2020-01-13 13:01:04
问题 I am developing an application with Laravel 5.2, it has to be implemented RESTFUL. It is also very easy to implement RESTful resources in Laravel. for example for getting all categories in json format in routes we just have to add Route::resource('category', 'CategoryController'); and then in the CategoryController we are going to have this for returning a JSON object of all categories: class CategoryController extends Controller public function index() { $categories = Category::all(); return

Laravel 5.2: retrieving a cookie via blade returns null also if cookie is set

落爺英雄遲暮 提交于 2020-01-13 10:12:20
问题 I set a cookie my_cookie via Javascript function createCookie(name, value, days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toUTCString(); } else { expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } .... createCookie('my_cookie', 1, 365); .... Via Chrome Cookie Inspector I see that the cookie is created with value 1. Via Laravel Blade I tried: @if (Cookie::get('my_cookie') !== null) // or

Laravel 5.2: The Process class relies on proc_open, which is not available on your PHP installation

我是研究僧i 提交于 2020-01-13 08:40:43
问题 I use cron job to do some CRUD operation using laravel Task Scheduling. On localhost and on my Share-Hosting server it worked fine for months until recently I keep getting this error when I run cron job on my Share-Hosting server. I did not make any changes to the code on my Share-Hosting server. [2017-07-14 09:16:02] production.ERROR: exception 'Symfony\Component\Process\Exception\RuntimeException' with message 'The Process class relies on proc_open, which is not available on your PHP

Laravel 5.3 Passport Custom Grants?

老子叫甜甜 提交于 2020-01-13 07:37:12
问题 I know I am not the only person who has come up to this point. Does anyone know how to properly implement a custom grant in Laravel(5.3) Passport? Or Have a good link/tutorial to reference how to properly do it? I know there's this package: https://github.com/mikemclin/passport-custom-request-grant But I'm asking for a more "Do it yourself" approach. Thank you in advance. 回答1: namespace App\Providers; use App\Auth\Grants\FacebookGrant; use Illuminate\Foundation\Support\Providers