jacksunny/viewfinder

There is no license information available for the latest version (v0.7) of this package.

extended plugin on view file finder from view name for laravel framework

v0.7 2017-06-12 11:30 UTC

This package is not auto-updated.

Last update: 2024-11-24 02:53:29 UTC


README

extended plugin on view file finder from view name for laravel framework

How to install and configurate package

  1. install the laravel package composer require "jacksunny/viewfinder":"dev-master"

please check exist line "minimum-stability": "dev" in composer.json if failed

  1. append new service provider file line in the section providers of file app.config after appended,it should looks like
   'providers' => [
        Illuminate\Auth\AuthServiceProvider::class,
        ......
        Jacksunny\ViewFinder\ExtendedViewServiceProvider::class,  //only default view finder class
        App\Providers\MyExtendedViewServiceProvider::class,       //custom my view finder class
    ],
   
  1. add test code to check if it works
    Route::get("/{entity}/{type}",function($entity,$type){
      return view("$entity.$type");
  });
  
  1. if wanna custom your ViewFinder you may create a class extends from AbsExtendedFileViewFinder,and a custom service provider extends from ExtendedViewServiceProvider
    class MyExtendedFileViewFinder extends AbsExtendedFileViewFinder {
    
     public function findNeededFilesInPath($name, $path, $user) {
       ...
     }
     
     class MyExtendedViewServiceProvider extends ExtendedViewServiceProvider {
     public function registerViewFinder() {
         $this->app->bind('view.finder', function ($app) {
             return new MyExtendedFileViewFinder($app['files'], $app['config']['view.paths']);
         });
     }
     
  2. please notify me if you got any problem or error on it,thank you!