Header set Access-Control-Allow-Origin "watch-media.loc'"
<?php
header('Access-Control-Allow-Origin : *');
$publicPath = getcwd();
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists($publicPath.$uri)) {
readfile($publicPath.$uri);
die();
}
require_once $publicPath.'/index.php';
public function social(){
$class = Str::camel(Str::singular($this->source));
$instance = $this->newRelatedInstance($class);
$foreignKey = 'id';
$localKey = 'field_id';
return $this->newHasOne($instance->newQuery(), $this, $instance->getTable().'.'.$foreignKey, $localKey);
}
public function genres() {
return $this->belongsToMany(game_genres::class, 'games_games_genres', 'game_name', 'genre_name', 'name', 'name')->withTimestamps();
}
//Для жанров
public function games() {
return $this->belongsToMany(games::class, 'games_games_genres', 'genre_name', 'game_name', 'name', 'name')->withTimestamps();
}
return array_merge(
[
'price' => $this->faker->randomFloat(2, 0, 100),
'old_price' => $this->faker->randomFloat(2, 0, 100),
'promo_categories' => $this->faker->randomElement(['sale', 'best_seller', 'featured']),
'description' => $this->faker->text,
'sizes' => $this->faker->randomElements(['s', 'm', 'l', 'xl', 'xxl'], $this->faker->numberBetween(1, 5)),
'colors' => $this->faker->randomElements(['red', 'blue', 'green', 'yellow', 'black'], $this->faker->numberBetween(1, 5)),
'categories' => $this->faker->randomElements(['men', 'women', 'kids', 'sport'])
],
$this->faker->randomElement([
['name' => 'Summer Dress', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=1'],
['name' => 'Shoulder Bag', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=2'],
['name' => 'Warm Hat', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=3'],
['name' => 'Black Sneakers', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=4'],
['name' => 'Summer Pants', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=5'],
['name' => 'T-Shirt', 'image' => 'https://dl.dropbox.com/s/bk1o8dt9rztsvj1/img.png?dl=6'],
]));