laravel-5.2

Reserved column names in Eloquent

橙三吉。 提交于 2019-12-04 03:26:58
问题 From a cursory look into Illuminate\Database\Eloquent\Model I can see the following instance attributes: protected $connection protected $table protected $primaryKey protected $perPage public $incrementing public $timestamps protected $attributes protected $original protected $relations protected $hidden protected $visible protected $appends protected $fillable protected $guarded protected $dates protected $dateFormat protected $casts protected $touches protected $observables protected $with

Laravel 5.2 Session values not persisting even when web middleware is used

给你一囗甜甜゛ 提交于 2019-12-04 00:57:04
I've got a Laravel 5.2 project that I'm using as a mock API for a javascript client I'm building out. The mock API functionality will be replaced with a different Laravel project later. For now, I just need to be able to submit API calls and get expected responses. In my mock API I'm storing the authentication status in the session. The problem I'm running into is that the values I put into the session are not persisting between http calls. This seemed similar to a different stackoverflow post I found , but the thing is I'm already using the web middleware for my API group. I thought it may be

WebSocket with Laravel 5.2

泄露秘密 提交于 2019-12-03 23:05:30
I'm doing a aplication in Laravel 5.2 that uses websockets. For the websocket connection I'm using HoaServer , wich works very well. The bad part is, I do not know how to make this server as a controller, or at least have acess to my models, right now I'm using a separeted PDO connection to make the DB querys. Someone knows if it is possible to make this server as a controller or at least have acess to the database throught laravel models? My server right now: require_once(__DIR__.'/../vendor/autoload.php'); $PDO = new PDO('mysql:host=127.0.0.1:3306;dbname=DBNAME', "USER", "PASS"); $websocket

Laravel 5.2 need an example which implements default Authentication Drivers / “Multi-Auth”. which needs lots of works right now as

女生的网名这么多〃 提交于 2019-12-03 17:55:52
问题 Authentication Drivers / "Multi-Auth" as prior to release of laravel 5.2 it is stated that multi auth suppots out of the box. but there is no any example codes showing how to authenticate using different drivers with routes. So I need help setting up the multi-auth using default laravel 5.2 回答1: Create two new models: App\Admin and App\User . Update config/auth.php : return [ 'defaults' => [ 'guard' => 'user', 'passwords' => 'user', ], 'guards' => [ 'user' => [ 'driver' => 'session',

disable web middleware for specific routes in laravel 5.2

ⅰ亾dé卋堺 提交于 2019-12-03 17:52:20
问题 I want to guest users have access to home page but in built in authentication process laravel redirects to login page. how can i give guest users access to home page? my routes.php: Route::group(['middleware' => 'web'], function () { Route::auth(); Route::get('/', 'HomeController@index'); Route::get('/insert', 'HomeController@insertform'); Route::get('/job/{id}', 'JobsController@show'); Route::get('/city/{city}', 'JobsController@city'); Route::post('/insert', 'HomeController@insert'); Route:

Laravel access request object outside controller

一世执手 提交于 2019-12-03 16:10:47
问题 According to the Laravel documentation Request is acquired via dependency injection. For a controller this is fine, but how do we access Request object outside a controller, for example in a view 回答1: There is request helper in laravel. You can use Request Object anywhere. For example request()->field_name Here's laravel documentation link for request helper https://laravel.com/docs/5.2/helpers#method-request 来源: https://stackoverflow.com/questions/38319707/laravel-access-request-object

Laravel valet not working

天大地大妈咪最大 提交于 2019-12-03 13:55:28
I use OSX El Capitan and PHP 7. I followed the installation guide so I install Laravel Valet version v1.1.3 successfully. I ping foo.dev or any.dev then the terminal prints "64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.116 ms" Everything is ok. My directory /User/mickey/Sites is added to Valet's paths. I created a Laravel 5.2 project named blog, then run the project with php artisan serve ok but when i accessed url blog.dev on the browser, the browser said This site can’t be reached, blog.dev refused to connect. ERR_CONNECTION_REFUSED. I don't know what is the problem with my installation

Vue.js interceptor

戏子无情 提交于 2019-12-03 13:31:12
How can I use a interceptor in vue.js ? So before every request/response it should first go to the interceptor. I already searched a lot but can't find a good documentation about that. I would like to use JWTAuth like this: (function (define) { 'use strict' define(function (require) { var interceptor interceptor = require('rest/interceptor') /** * Authenticates the request using JWT Authentication * * @param {Client} [client] client to wrap * @param {Object} config * * @returns {Client} */ return interceptor({ request: function (request, config) { var token, headers token = localStorage

Undefined variable: errors — Laravel 5.2

天涯浪子 提交于 2019-12-03 12:03:00
问题 I am new in Laravel and using laravel version 5.2. I created a controller and request named as ArticlesController and CreateArticleRequest respectively and i defined some validation rules. CreateArticleRequest <?php namespace App\Http\Requests; use App\Http\Requests\Request; class CreateArticleRequest extends Request { public function authorize() { return true; } public function rules() { return [ 'title' => 'required|min:3', 'body' => 'required|max:400', 'published_at' => 'required|date', ];

Image source not readable in Laravel 5.2 - Intervention Image

社会主义新天地 提交于 2019-12-03 11:36:51
I have a small problem concerning the resizing process of a given image, I am trying to submit a form containing an input type -->file<-- I was able to upload a picture without resizing it, after that I decided to resize that image so I installed the Intervention Image Library using: composer require intervention/image then I integrated the library into my Laravel framework Intervention\Image\ImageServiceProvider::class 'Image' => Intervention\Image\Facades\Image::class and finally I configured it like following php artisan vendor:publish --provider="Intervention\Image