laravel-5.2

( (Where and Where) OR (Where and Where) ) Laravel 5.2

柔情痞子 提交于 2020-08-27 05:57:28
问题 I am trying to create ( (Where and Where) OR (Where and Where) ) And after a lot of searching I found this $sender = \App\User::where('username','=',$username)->firstOrFail(); $receiver = Auth::user(); $messages = \App\Message::Where(function($query) { $query->where("sender",$sender->id) ->where("receiver",$receiver->id); }) ->orWhere(function($query) { $query->Where("sender",$receiver->id) ->Where("receiver",$sender->id); }) ->get(); But it's showing me that the $sender and the $receiver

( (Where and Where) OR (Where and Where) ) Laravel 5.2

别来无恙 提交于 2020-08-27 05:57:09
问题 I am trying to create ( (Where and Where) OR (Where and Where) ) And after a lot of searching I found this $sender = \App\User::where('username','=',$username)->firstOrFail(); $receiver = Auth::user(); $messages = \App\Message::Where(function($query) { $query->where("sender",$sender->id) ->where("receiver",$receiver->id); }) ->orWhere(function($query) { $query->Where("sender",$receiver->id) ->Where("receiver",$sender->id); }) ->get(); But it's showing me that the $sender and the $receiver

Laravel Project ERR_EMPTY_RESPONSE

一曲冷凌霜 提交于 2020-08-06 10:19:33
问题 I am facing a very critical issue on server where i hosted a Laravel application project.I have some other projects hosted there. Some times I see "ERR_EMPTY_RESPONSE" error on browser. But at the same time other Project working well.If i restart the service "httpd" of that project it starts working again. I tried to go every solution i got from internet.but no luck. 回答1: Please make a try adding this line at the top of .htaccess file in ur project php_flag opcache.enable Off hope it works

Laravel 5 Model $cats to array utf-8 JSON_UNESCAPED_UNICODE

廉价感情. 提交于 2020-08-03 03:21:07
问题 When you have an array field and save it in the DB it does a nifty json_encode to the array but without the JSON_UNESCAPED_UNICODE option. The data end up like so : {"en":"\u039d\u03ad\u03b1"} which is pretty much useless. The solution of course is to json_encode with the JSON_UNESCAPED_UNICODE flag. Is it possible to tell Laravel to add this option before saving the model? I am trying to avoid using the setNameAttribute mutator as this would be kind of a pain to do it every time i have this

Laravel blade @can policy - string

こ雲淡風輕ζ 提交于 2020-07-16 06:10:12
问题 I am using Laravel 5.2. So I'm learning about how to deal with roles and permissions Authorization. Everything runs fine. I even made my own policy PostPolicy. And now to the problem. I load the $post data into the view in the PostsController which then loads in blade. PostsController : public function show($id) { $post = Post::find($id); return view('posts.show', compact('post')); } posts/show.blade.php : @section('content') <!-- begin --> @can('hasRole', Auth::user()) <h1>Displaying Admin

Braintree's payment_method_nonse is empty when trying to post data to server

梦想与她 提交于 2020-07-09 19:54:22
问题 I'm trying to set up DROP-IN UI. I'm using Laravel 5.2 on the backend ( followed the setup as explained in the docs: [https://laravel.com/docs/5.2/billing#braintree-configuration] and i have created a BraintreeController.php and it returns the client token as json . It looks like this: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Braintree_ClientToken; use App\Http\Requests; class BraintreeController extends Controller { public function token() { return response()-

Braintree's payment_method_nonse is empty when trying to post data to server

烈酒焚心 提交于 2020-07-09 19:54:20
问题 I'm trying to set up DROP-IN UI. I'm using Laravel 5.2 on the backend ( followed the setup as explained in the docs: [https://laravel.com/docs/5.2/billing#braintree-configuration] and i have created a BraintreeController.php and it returns the client token as json . It looks like this: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Braintree_ClientToken; use App\Http\Requests; class BraintreeController extends Controller { public function token() { return response()-

How to use Relation::morphMap() for diffrent class

若如初见. 提交于 2020-06-27 16:29:18
问题 I am using laravel polymorphic relation. I have defined two morphTo relations for two purpose. My question is that ,but when I am defining the key of Relation::morphMap() function array , then my array key is same for one case, so I want to know is there any way by which I can specify that I am defining relation for specific class. My first relation.... Package.php public function provider() { return $this->morphTo(null, 'map_type_id', 'map_id'); } Venue.php public function packages() {