davide-casiraghi/laravel-cards

A flexible and extensible content container with multiple variants and options.

2.1.2 2020-01-21 13:26 UTC

This package is auto-updated.

Last update: 2024-03-22 01:25:01 UTC


README

Latest Stable Version on Packagist StyleCI Build Status Quality Score Coverage Status 68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64356362373962626430653962336132393430652f6d61696e7461696e6162696c697479 GitHub last commit

This Laravel package show a responsive card made by text on one side of the page and an image on the other.

The library replace all the occurances of this snippet

{# card card_id=[1] #}

With the some HTML code of a responsive card made by text on one side and an image on the other.
This code uses bootstrap 4.

<div class='row laravel-card' style='background-color: #345642;color: #212529;'>
	<div class='text col-md-9 my-auto px-4 order-md-1'>
		<h2 class='laravel-card-heading mt-5'>".$card_1['title']."</h2>
		<div class='lead mb-4'>".$card_1['body']."</div>
	</div>
<div class='image col-md-3 order-md-2'></div>

</div>

Installation

You can install the package via composer:

bash composer require davide-casiraghi/laravel-cards

Publish all the vendor files

php artisan vendor:publish --force

Import the _card.scss file in /resources/scss/app.scss

@import 'vendor/laravel-cards/card';

and then run in console:
npm run dev

Usage

Authorization

To work the package aspect that in your user model and table you have a field called group that can have this possible values:

  • null: Registered user
  • 1: Super Admin
  • 2: Admin

Just the users that have Admin and Super admin privileges can access to the routes that allow to create, edit and delete the blogs, categories and posts. Otherwise you get redirected to the homepage.

Access to the package

After the package is published this new route will be available:

/laravel-cards

Accessing to this routes you can manage the cards.

Then to replace all the occurrance of the card snippets:

use DavideCasiraghi\LaravelCards\Facades\LaravelCards;  

$text = LaravelCards::replace_card_snippets_with_template($text);

Testing

bash ./vendor/bin/phpunit --coverage-html=html

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email davide.casiraghi@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.