Cum facem un fisier Helpers in Laravel 5

postat acum 3 ani de Stefanescu Mihai in categorie iNoob

In acest articol am sa va arat cum puteti crea un fisier helpers in Laravel 5 in care puteti stoca functii custom ca mai apoi sa le puteti apela ca in aplicatia voastra.

  1. Creati un fisier app/helpers.php si definiti-va functiile dorite in el.
  2. Acum trebuie sa-l bagam in autoload astfel incat aceste functii sa poata fi folosite oriunde in aplicatie. Deschide-ti fisierul composer.json si in array-ul de fisiere adaugati “app/helpers.php”:
"autoload": {
		"classmap": [
			"database",
			"app/Http/Controllers",
			"app/Models"
		],
		"psr-4": {
			"App\\": "app/"
		},
		"files": [
    	           "app/helpers.php"
	   ]

       3.  Rulati comanda: composer dump-autoload

Acum puteti defini functii custom in acest fisier si apoi le puteti folosi oriunde in aplicatie.

Sunt un tanar programator din Bucuresti ce lucreaza in PHP/Mysql (MySqli/PDO), Laravel, CodeIgniter, MySQL, PostgreSQL, Wordpress, HTML5/CSS3, Sass, Photoshop si multe altele.
Google+ Community Facebook Group

Comentariu postate de minecraft free download pc la data de 14.05.2019
Good information. Lucky me I recently found your website by accident (stumbleupon). I've saved it for later!
Comentariu postate de minecraft download for free la data de 17.05.2019
Pretty great post. I just stumbled upon your weblog and wished to say that I've truly loved browsing your blog posts. In any case I'll be subscribing for your feed and I am hoping you write once more soon!
Comentariu postate de minecraft download mojang la data de 17.05.2019
If you desire to increase your know-how just keep visiting this web site and be updated with the most recent news posted here.