laravel-5.2

Yajra Datatables Package for Laravel deosnt work properly with laravel 5.2

故事扮演 提交于 2019-12-13 02:01:32
问题 I have installed yajra/laravel-datatables-oracle "~6.0" package for supporting server-side datatables in laravel 5.2 with MySql as database. i'm trying to display the datatable of users: //routes.php Route::group(['middleware' => ['web'], 'prefix' => 'user'], function () { Route::get('/index', 'UserController@index')->name('user.index'); }); and here is my controller: //UserController.php public function index() { return view('user.index'); } public function indexData() { $users = User:

Laravel 5.2 admin dashboard

坚强是说给别人听的谎言 提交于 2019-12-13 01:39:50
问题 Some laravel master's help needed. I want to make admin account login and dashboard. Out of the box laravel provides authentication with table users . I've added table roles and a column users(role_id) so i can differ users. Many hours of searching didnt help cause in most cases it was dumb way of duplicating of native authentication with two tables for different users. Kernel.php protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie

Laravel 5.2 reset password + Mandrill

爱⌒轻易说出口 提交于 2019-12-13 00:44:34
问题 I have Laravel 5.2 fresh installation. I did following: I have set up my .env file MAIL_DRIVER=mandrill SECRET=my_mandrill_api_key I have installed Guzzle (https://github.com/guzzle/guzzle) I have setup my email in view (https://github.com/laravel/laravel/blob/5.0/resources/views/emails/password.blade.php) I have fixed the certificate issue (PHP cURL error code 60) So it seems everything is done correctly. When I fill email to reset password and press Send Password Reset Link button, I get

Laravel Blade check user role

爷,独闯天下 提交于 2019-12-12 22:26:22
问题 In laravel Blade templating we can exclude some parts of HTML with this code: @if (Auth::user()) <li><a href="{{ url('/home') }}">Mein Profil</a></li> <li><a href="{{ url('/admin') }}">Admin</a></li> @else <li><a href="{{ url('/home') }}">Mein Profil</a></li> @endif If user is authenticated then show home and admin links and if user is not authenticated then show only home link. My question is how to make a check here if user is admin? I have default login system from laravel and i just added

Can I get custom date format for pluck(lists) on Laravel5?

妖精的绣舞 提交于 2019-12-12 22:24:39
问题 My DB records are this. tests table id date 1 2016-07-01 2 2016-07-31 3 2016-08-01 4 2016-08-15 5 2016-08-31 6 2016-09-01 I wanna choose record by month. Now my code is this. Controller $months = \App\Test::where('date', '<=', 'now()') ->orderBy('date', 'desc') ->pluck('date', 'date'); View {{ Form::select('month', $months, old('month'), ['id' => 'month']) }} ( that generate this. ) <select id="month" name="month"> <option value="2016-07-01">2016-07-01</option> <option value="2016-07-31">2016

Laravel and redis scan

╄→гoц情女王★ 提交于 2019-12-12 20:45:35
问题 I am trying to use redis scan with laravel. I can make a single request which returns 10 keys but I wish to loop until all the keys have been returned. I am unsure how to do this with laravel. Currently I have $test = Redis::scan(0, 'match', '*keypattern*'); I don't know if there is a 'laravel' way of doing this. EDIT: I used composer to import predis/predis and got it working with use Predis\Collection\Iterator; use Predis; ... $client = new Predis\Client([ 'scheme' => 'tcp', 'host' =>

Object key value corrupted

落花浮王杯 提交于 2019-12-12 18:08:38
问题 Good day The following code is used in a Laravel framework to return data from our server: $ses = DB::connection('odbc') ->table('HBO.SM200T') ->where('USRPF1', '=', strtoupper(auth()->user()->name)) ->first(); But on one of my pc's it returns my data fine as below: {#780 ▼ +"WAGWRD": "VTER" +"PERSNR": "56846" +"STELS": "59" +"TAK": "324" +"BESKR": " " +"STVDAT": "99999999" +"TAALN": "2" +"USRPF1": "AV " +"USRPF2": " " } But on my new installation of Fedora 24 it returns as: {#783 ▼ +b"W\x00‚

Eloquent pre-loading relationships against DB write connection

。_饼干妹妹 提交于 2019-12-12 17:13:01
问题 I have a Laravel 5.2 project with a DB master-slave setup. When running something like Model::onWriteConnection()->with('relationship')->find($id) , only the find() query is run against the write connection; the with() query is still run against a slave. This particular query must be run against the master connection, since the relevant data may not have been replicated to the slaves yet. Is there a way to force all parts of the eloquent query to run against the write connection? 回答1: try

Laravel API Test - How to test API that has external API call

試著忘記壹切 提交于 2019-12-12 13:07:49
问题 My API code public function store (Request $request, $profileId) { $all = $request->all(); $token = AccessToken::with('users')->where('access_token',$request->input('access_token'))->first(); if($token && $token->users->isOwnProfile($profileId)) { $rules = [ 'access_token' => 'required', 'title' => 'required', 'description' => 'required', 'file_id' => 'required', 'audience_control' => 'required|in:' . join(',', PostRepository::$AUDIENCE_CONTROL), 'tags' => 'required', ]; $validator =

In Laravel how to create a queue object and set their connection without Facade

帅比萌擦擦* 提交于 2019-12-12 11:13:17
问题 In Lumen/Laravel I want to send a message to a given queue. by default I have it set to Redis, what I would like is to send it to another queue server as another application will take care of it. I know I can do $queue->pushRaw('payload'); However there is no subsequent way for me to pick the connection. I am aware that I can use Facade to create my Queue as such: $connection = Queue::connection('connection_name'); $connection->pushOn('queue_name', $job) However I'm doing this in Lumen, and