PHP code example of marcohern / dimages
1. Go to this page and download the library: Download marcohern/dimages library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marcohern / dimages example snippets
use Illuminate\Database\Seeder;
class UserSeeder extends Seeder
{
protected $users = [
['name' => 'Son Goku', 'email' => '[email protected] ', 'password' => 'goku'],
['name' => 'Bulma', 'email' => '[email protected] ', 'password' => 'bulma'],
['name' => 'Master Roshi', 'email' => '[email protected] ', 'password' => 'masterroshi'],
['name' => 'Yamcha', 'email' => '[email protected] ', 'password' => 'yamcha'],
['name' => 'Krillin', 'email' => '[email protected] ', 'password' => 'krillin'],
['name' => 'Tien Shinhan', 'email' => '[email protected] ', 'password' => 'tienshinhan'],
['name' => 'Picollo', 'email' => '[email protected] ', 'password' => 'picollo']
];
public function run()
{
foreach ($this->users as $k => $u) {
$now = (new \Datetime("now"))->format('Y-m-d H:i:s');
$this->users[$k]['email_verified_at'] = $now;
$this->users[$k]['created_at'] = $now;
$this->users[$k]['updated_at'] = $now;
$this->users[$k]['password'] = bcrypt($u['password']);
}
DB::table('users')->insert($this->users);
}
}
return [
'densities' => [
'ldpi' => 0.75,
'mdpi' => 1.00,
'hdpi' => 1.50,
'xhdpi' => 2.00,
'xxhdpi' => 3.00,
'xxxhdpi' => 4.00,
'single' => 1.00,
'double' => 2.00,
],
'profiles' => [
'ref' => [480, 320],
'launcher-icons' => [48, 48],
'actionbar-icons' => [24, 24],
'small-icons' => [16, 16],
'notification-icons' => [22, 22],
]
];
'providers' => [
...
/*
* Package Service Providers...
*/
Marcohern\Dimages\DimagesServiceProvider::class,
...
]
bash
$ php artisan passport:install
bash
$ php artisan make:seeder UserSeeder
Seeder created successfully.
bash
$ php artisan db:seed --class=UserSeeder
Database seeding completed successfully.
bash
$ php artisan vendor:publish
bash
Copied File [\vendor\marcohern\dimages\publishables\config\dimages.php] To [\config\dimages.php]
dos
.../laravel_packages>composer dump-autoload