Laravel 10 - Wink Publishing Platform

Touseef Afridi
12 Sep 24

Laravel 10 - Wink Publishing Platform

In this tutorial, we will discuss how to implement the Wink publishing platform in Laravel 10, which simplifies managing and publishing blog content efficiently


If you're a video person, feel free to skip the post and check out the video instead!


Step # 1 : Create fresh Laravel project.

Two commands to create fresh Laravel project.
Global Command : laravel new wink
Or use
Non Global Command : composer create-project laravel/laravel --prefer-dist wink

Step # 2 : Access the project.

Open a terminal (e.g., Git Bash) and navigate to your Laravel project's root folder.
Git Bash : cd c:xampp/htdocs/wink
Next, install the required dependencies and run the Laravel Vite development server for front-end assets:
Command : npm install && npm run dev
In a new terminal window or tab (while keeping the Vite server running), navigate to the same project directory to execute further Laravel command.

Step # 3 : Install Wink.

Install the package.
Command : composer require themsaid/wink
Run the Wink installation command, which publishes the necessary files and creates the required database tables.
Command : php artisan wink:install
Create a symbolic link between the storage folder and public to access uploaded files
Command : php artisan storage:link

Step # 4 : Define Wink database connection in .env file.

Open your .env file. Add the following line to set up Wink's database connection.
WINK_DB_CONNECTION=MySQL
This ensures that Wink uses the specified database connection (in this case, MySQL) to store blog content.

Step # 5 : Migrate the tables.

Run the default Laravel migrations to create the necessary tables for your application.
Command : php artisan migrate
Run Wink-specific migrations to create the tables needed for Wink's blogging functionality.
Command : php artisan wink:migrate
Wink will automatically create an admin user and display the admin login details (email and password) in the console. These credentials are required to access the Wink dashboard, where you can manage your blog content. Make sure to save these credentials as they will not be displayed again.


Step # 6 : It's time to test.

Start the Laravel development server.
Command : php artisan serve.
Access the below URL.
127.0.0.1:8000/wink
Login with the credentials and you will see the admin Dashboard where you can update profile, Create Posts, Pages, Tags & Teams.




Example to fetch the data in web.php.
use Wink\WinkPost;
Route::get('/all', function(){
    $posts = WinkPost::all();
    // Dump and die the posts for debugging
    // dd($posts);
    foreach ($posts as $post) {
        echo $post->title . "<br>";
    }
});
To fetch Pages, Tags, and Teams using Wink models, you should include the respective classes in your web.php file or controller.
To get Posts, include: use Wink\WinkPost;
To get Pages, include: use Wink\WinkPage;
To get Tags, include: use Wink\WinkTag;
To get Teams, include: use Wink\WinkTeam;


Share this with friends!


"Give this post some love and slap that 💖 button as if it owes you money! 💸😄"
0

0 Comments

To engage in commentary, kindly proceed by logging in or registering