Created
September 6, 2018 03:15
-
-
Save mazfreelance/0f00c41a1a9f11358bf87a5878a0a945 to your computer and use it in GitHub Desktop.
Dynamic List Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Model | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class ModelName extends Model | |
{ | |
protected $table = 'table_name_dB'; | |
} | |
//Provider | |
namespace App\Providers; | |
use App\ModelName; | |
use Illuminate\Support\ServiceProvider; | |
class ProviderName extends ServiceProvider | |
{ | |
/** | |
* Bootstrap services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
view()->composer('*', function($view){ | |
$view->with('array_name', ModelName::all()); | |
}); | |
} | |
... | |
//config/app.php | |
App\Providers\ProviderName::class, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment