laravel

Laravel Excel Style with CSS not working while exporting view

。_饼干妹妹 提交于 2021-02-11 12:25:21
问题 I am trying to export view using laravel Excel 3.1. While the export is working, I am not being able to style it. My laravel Export looks as: <?php namespace App\Exports; use Illuminate\Contracts\View\View; use Maatwebsite\Excel\Concerns\FromView; use Maatwebsite\Excel\Concerns\WithEvents; use Maatwebsite\Excel\Concerns\RegistersEventListeners; use Maatwebsite\Excel\Events\AfterSheet; class MatrixExcelExport implements FromView, WithEvents { use RegistersEventListeners; protected $data,

Laravel Rest Apis working in reqbin.com but not in postman also not working in the app

给你一囗甜甜゛ 提交于 2021-02-11 12:24:28
问题 Here is a screenshot from the postman Post Man Call Screenshot Screenshot from reqbin.com It showing the following exception on the postman! Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: in file /home/elitbzfn/ecoplus.work/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php on line 255 Reqbin Screenshot Please tell me what could be the issue here possibly! Thanks If you anything fee free to ask me! Thanks Headers Headers 回答1: Try with https and not with

Eloquent Count nested relationships

萝らか妹 提交于 2021-02-11 12:20:30
问题 | Data | DataChildren | Category ---------------------------------- | id | id | id | name | data_id | name | | category_id | | | name | Data Model: public function data_children() { return $this->hasMany(DataChildren::class, 'data_id', 'id'); } DataChildren Model: public function category() { return $this->belongsTo(Category::class, 'category_id', 'id'); } I want to get count of Category based on Data id through DataChildren . I just want to take the Category records from Data so the result

Laravel 6 Event Listener Mailable Queue unable to access

亡梦爱人 提交于 2021-02-11 12:09:46
问题 Environment: php: 7.4.2 laravel: 6.15.0 Scenario : Upon user registration, event(new NewUserHasRegisteredEvent($user)); is triggered. In my EventServiceProvider.php protected $listen = [ NewUserHasRegisteredEvent::class => [ \App\Listeners\WelcomeNewUserListener::class, ], ]; My NewUserHasRegisteredEvent.php <?php namespace App\Events; use App\User; use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PresenceChannel; use

Invalidating Session not logging out - Laravel 5

旧巷老猫 提交于 2021-02-11 12:06:10
问题 So basically a user can stay logged in accross iPhone, Chrome, Firefox and multiple browsers and I want to stop that, and only allow the user to be logged in at (1 session only at a time). Meaning: When the user logs in somehwere else... it logs them out on the other. I have added the following to the very bottom of my LoginController.php /** * The user has been authenticated. * * * @return mixed */ protected function authenticated() { \Auth::logoutOtherDevices(request($password)); } I also

Invalidating Session not logging out - Laravel 5

房东的猫 提交于 2021-02-11 12:03:11
问题 So basically a user can stay logged in accross iPhone, Chrome, Firefox and multiple browsers and I want to stop that, and only allow the user to be logged in at (1 session only at a time). Meaning: When the user logs in somehwere else... it logs them out on the other. I have added the following to the very bottom of my LoginController.php /** * The user has been authenticated. * * * @return mixed */ protected function authenticated() { \Auth::logoutOtherDevices(request($password)); } I also

laravel 博客(resource)

只愿长相守 提交于 2021-02-11 11:15:05
laravel的资源路由极大的方便了数据库的增删改查 1、创建资源路由 Route:: resource ('article','ArticleController'); 2、查看。创建好资源路由后,通过artisan命令创建控制器。 php artisan make: controller ArticleController; php artsian route : list //查看资源路由列表,如图所示 分析一下上面的路由; ①、get方法直接访问admin/article,可以直接访问ArticleController@index; 用于页面的显示,直接提取数据库显示在页面 public function index(){ $data = Article::orderBy('art_id','desc')->paginate(5 ); return view('admin.article.index', compact ('data' )); } ②、post方法访问admin/article,访问的是ArticleController@store; 用于数据的添加;(需要csrf认证) public function store(){ $input = Input::except('_token' ); $input ['art_time'] = time ();

laravel的资源路由resource

浪尽此生 提交于 2021-02-11 10:43:34
最近在学习laravel,在需要在路由中参数的时候发现了一个很好玩的懂西resource路由特地记下期详细用法 路由列表 Route::resource('re','Admin\ReController');  Controller  <? php namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Input; class ReController extends Controller { // get.re 全部分类列表 public function index( $id = null ){ echo "这里是index方法不能传入参数" ; } // get.re/create 添加分类 public function create(){ echo "这里是create方法不能传入参数" ; } // post.re 添加分类提交 public function store(){ echo "这里是store方法不能传入参数" ; } // get.re/{id} 显示单个分类 public function show( $id ){ echo

Laravel 资源路由

回眸只為那壹抹淺笑 提交于 2021-02-11 10:34:56
Laravel 资源路由 Resource 请求方法 请求URI 对应的控制器方法 代表的意义 GET /log index 索引/列表 GET /log/create create 创建(显示表单) POST /log store 保存你创建的数据 GET /log/{id} show 显示对应id的内容 GET /log/{id}/edit edit 编辑(显示表单) PUT/PATCH /log/{id} update 保存你编辑的数据 DELETE /log/{id} destroy 删除 来源: oschina 链接: https://my.oschina.net/u/2401265/blog/1068677

Laravel: dynamic configuration for Pusher

最后都变了- 提交于 2021-02-11 08:44:07
问题 I am trying to make the configuration for Pusher in my Laravel app (SaaS) dynamic. Basically I want to store different Pusher configs for different accounts. And call the corresponding config based on the user. I have tries to change the config in runtime using config()->set('services.pusher.xxx', 'yyyy') , but this doesn't work at any level of the framework, event in a custom ServiceProvider. I found Laravel's BroadcastManager and tried to override the createPusherDriver() so that I could