Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8e9897d4

Přidáno uživatelem Marek Zábran před více než 4 roky(ů)

Issue #7692 @3h
Otestování datového modelu a vypracování návodu pro vytvoření databáze.

Zobrazit rozdíly:

README.md
1 1
# Aplikace pro muzea - MERLOT
2 2

  
3
Jak zprovoznit projekt:
3
###### Jak zprovoznit projekt:
4 4

  
5 5
1. Stáhněte **PHPStorm** (zdarma přes školní licenci), **PHP** (ideálně verze 7.4 a výš, minimálně verze 7.2.5) a **Composer**. Všechny tyto nainstalujte (PHP se neinstaluje).
6 6
2. Ve složce s PHP přejmenujte _php.ini-developement_ na _php.ini_ a v souboru odkomentujte všechny extension kromě _ffi_, _ftp_, _mbstring_, _exif_, _oci8_12c_, _openssl_, _pdo_firebird_, _pdo_oci_.
......
14 14
    3. `php artisan key:generate`
15 15
8. V PHPStorm v **Run/Edit Configurations** přidejte **PHP Build-in Web Server** , jeho _document root_ je složka projektu a _use router script_ ukazuje na **server.php** ve stejné složce.
16 16
9. Spusťte projekt projekt. Na localhost by vám měl vyjet nápis **Laravel** s funkčním menu.
17

  
18
###### Jak zprovoznit databázi:
19

  
20
1. Zajistěte databázi se spojením určeným v souboru `.env`.
21
2. Spusťte v terminálu (PHPStorm nebo cmd ve složce projektu) příkaz `php artisan migrate`.
22

  
app/Providers/AppServiceProvider.php
3 3
namespace App\Providers;
4 4

  
5 5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Support\Facades\Schema;
6 7

  
7 8
class AppServiceProvider extends ServiceProvider
8 9
{
......
24 25
    public function boot()
25 26
    {
26 27
        //
28
        Schema::defaultStringLength(200);
27 29
    }
28 30
}
config/database.php
48 48
            'url' => env('DATABASE_URL'),
49 49
            'host' => env('DB_HOST', '127.0.0.1'),
50 50
            'port' => env('DB_PORT', '3306'),
51
            'database' => env('DB_DATABASE', 'forge'),
52
            'username' => env('DB_USERNAME', 'forge'),
51
            'database' => env('DB_DATABASE', 'mydb'),
52
            'username' => env('DB_USERNAME', 'root'),
53 53
            'password' => env('DB_PASSWORD', ''),
54 54
            'unix_socket' => env('DB_SOCKET', ''),
55 55
            'charset' => 'utf8mb4',
database/migrations/.2014_10_12_000000_create_users_table.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateUsersTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('users', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('name');
19
            $table->string('email')->unique();
20
            $table->timestamp('email_verified_at')->nullable();
21
            $table->string('password');
22
            $table->rememberToken();
23
            $table->timestamps();
24
        });
25
    }
26

  
27
    /**
28
     * Reverse the migrations.
29
     *
30
     * @return void
31
     */
32
    public function down()
33
    {
34
        Schema::dropIfExists('users');
35
    }
36
}
database/migrations/.2019_08_19_000000_create_failed_jobs_table.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateFailedJobsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('failed_jobs', function (Blueprint $table) {
17
            $table->id();
18
            $table->text('connection');
19
            $table->text('queue');
20
            $table->longText('payload');
21
            $table->longText('exception');
22
            $table->timestamp('failed_at')->useCurrent();
23
        });
24
    }
25

  
26
    /**
27
     * Reverse the migrations.
28
     *
29
     * @return void
30
     */
31
    public function down()
32
    {
33
        Schema::dropIfExists('failed_jobs');
34
    }
35
}
database/migrations/2014_10_12_000000_create_users_table.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateUsersTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('users', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('name');
19
            $table->string('email')->unique();
20
            $table->timestamp('email_verified_at')->nullable();
21
            $table->string('password');
22
            $table->rememberToken();
23
            $table->timestamps();
24
        });
25
    }
26

  
27
    /**
28
     * Reverse the migrations.
29
     *
30
     * @return void
31
     */
32
    public function down()
33
    {
34
        Schema::dropIfExists('users');
35
    }
36
}
database/migrations/2019_08_19_000000_create_failed_jobs_table.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateFailedJobsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('failed_jobs', function (Blueprint $table) {
17
            $table->id();
18
            $table->text('connection');
19
            $table->text('queue');
20
            $table->longText('payload');
21
            $table->longText('exception');
22
            $table->timestamp('failed_at')->useCurrent();
23
        });
24
    }
25

  
26
    /**
27
     * Reverse the migrations.
28
     *
29
     * @return void
30
     */
31
    public function down()
32
    {
33
        Schema::dropIfExists('failed_jobs');
34
    }
35
}
database/migrations/2020_03_20_000000_CreateCategoryTable.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateCategoryTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('categories', function (Blueprint $table) {
17
            $table->id();
18

  
19
            $table->string('nameCZ');
20
            $table->string('nameEN');
21
        });
22
    }
23

  
24
    /**
25
     * Reverse the migrations.
26
     *
27
     * @return void
28
     */
29
    public function down()
30
    {
31
        Schema::dropIfExists('categories');
32
    }
33
}
database/migrations/2020_03_20_000000_CreateMetadataTable.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateMetadataTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('metadata', function (Blueprint $table) {
17
            $table->id();
18
            $table->integer('artefact_id')->unsigned();
19
            $table->foreign('artefact_id')->references('id')->on('artefacts');
20

  
21
            $table->string('name');
22
            $table->longText('noteCZ');
23
            $table->longText('noteEN');
24

  
25
            $table->integer('page');
26
            $table->integer('likes');
27
        });
28
    }
29

  
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists('metadata');
38
    }
39
}
database/migrations/2020_03_20_000000_create_artefacts_table.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateArtefactsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('artefacts', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('name');
19
            $table->string('author');
20
            $table->string('made_in');
21
            $table->string('publisher');
22
            $table->integer('year');
23
            $table->integer('pages');
24
            $table->integer('likes');
25
        });
26
    }
27

  
28
    /**
29
     * Reverse the migrations.
30
     *
31
     * @return void
32
     */
33
    public function down()
34
    {
35
        Schema::dropIfExists('artefacts');
36
    }
37
}
database/migrations/CreateArtefactsTable.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateArtefactsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('artefacts', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('name');
19
            $table->string('author');
20
            $table->string('made_in');
21
            $table->string('publisher');
22
            $table->integer('year');
23
            $table->integer('pages');
24
            $table->integer('likes');
25
        });
26
    }
27

  
28
    /**
29
     * Reverse the migrations.
30
     *
31
     * @return void
32
     */
33
    public function down()
34
    {
35
        Schema::dropIfExists('artefacts');
36
    }
37
}
database/migrations/CreateCategoryTable.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateCategoryTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('categories', function (Blueprint $table) {
17
            $table->id();
18

  
19
            $table->string('nameCZ');
20
            $table->string('nameEN');
21
        });
22
    }
23

  
24
    /**
25
     * Reverse the migrations.
26
     *
27
     * @return void
28
     */
29
    public function down()
30
    {
31
        Schema::dropIfExists('categories');
32
    }
33
}
database/migrations/CreateMetadataTable.php
1
<?php
2

  
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6

  
7
class CreateMetadataTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('metadata', function (Blueprint $table) {
17
            $table->id();
18
            $table->integer('artefact_id')->unsigned();
19
            $table->foreign('artefact_id')->references('id')->on('artefacts');
20

  
21
            $table->string('name');
22
            $table->longText('noteCZ');
23
            $table->longText('noteEN');
24

  
25
            $table->integer('page');
26
            $table->integer('likes');
27
        });
28
    }
29

  
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists('metadata');
38
    }
39
}

Také k dispozici: Unified diff