<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amela🦦</title>
    <description>The latest articles on DEV Community by Amela🦦 (@ameliniya_).</description>
    <link>https://dev.to/ameliniya_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F921974%2F8115ad25-a38c-4aed-8617-75b3522fc075.jpg</url>
      <title>DEV Community: Amela🦦</title>
      <link>https://dev.to/ameliniya_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ameliniya_"/>
    <language>en</language>
    <item>
      <title>How to get started with Filament</title>
      <dc:creator>Amela🦦</dc:creator>
      <pubDate>Wed, 07 Sep 2022 11:44:51 +0000</pubDate>
      <link>https://dev.to/ameliniya_/how-to-get-started-with-filament-2fi1</link>
      <guid>https://dev.to/ameliniya_/how-to-get-started-with-filament-2fi1</guid>
      <description>&lt;p&gt;&lt;a href="https://filamentphp.com/"&gt;Filament&lt;/a&gt; is a package for the PHP Framework Laravel built using the TALL-Stack.&lt;br&gt;
&lt;strong&gt;T&lt;/strong&gt; - &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;A&lt;/strong&gt; - &lt;a href="https://alpinejs.dev/"&gt;Alpine.js&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;L&lt;/strong&gt; - &lt;a href="https://laravel.com/"&gt;Laravel&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;L&lt;/strong&gt; - &lt;a href="https://laravel-livewire.com/"&gt;Livewire&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to build a good looking Admin Panel, add Forms or Tables to your Laravel project, this tool will save you a lot of time and code! If you want to look at it first before installing, look at their &lt;a href="https://demo.filamentphp.com/login"&gt;demo&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;I'm here to collect a few tips and trick on how to quickly get started with the Admin Panel.&lt;/p&gt;

&lt;p&gt;First, install the package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;composer&lt;/span&gt; &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;filament&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;filament&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"^2.0"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to access your Admin Panel, attach &lt;code&gt;"/admin"&lt;/code&gt; to your app URL.&lt;/p&gt;

&lt;p&gt;Next, create a user&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;filament&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can enter a name, e-mail and password. If you have added non-nullable columns in your &lt;code&gt;users&lt;/code&gt; table, you would have to make a default user in your factory.&lt;/p&gt;

&lt;p&gt;One of the most powerful tools will be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;composer&lt;/span&gt; &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;doctrine&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;dbal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this package, Filament can auto-generate forms and tables based on your models' database columns. To create a &lt;code&gt;Resource&lt;/code&gt;, from the models' database columns all you need to do is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;filament&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="nc"&gt;YourModelName&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;generate&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With just this one command you create a &lt;code&gt;Create&lt;/code&gt;, &lt;code&gt;List&lt;/code&gt; and &lt;code&gt;Edit&lt;/code&gt; Page:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;List&lt;/strong&gt;: a table filled with all your database columns &lt;code&gt;your_app_url/admin/your_model_name&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create&lt;/strong&gt;: an empty form which saves information into your database &lt;code&gt;your_app_url/admin/your_model_name/create&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edit&lt;/strong&gt;: a form filled with the records information &lt;code&gt;your_app_url/admin/your_model_name/ID/edit&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can change your form and table in your models' &lt;code&gt;Resource&lt;/code&gt; file. There is a variety of available fields and columns, filters and actions.&lt;/p&gt;




&lt;p&gt;This is optional, but you can also create a &lt;code&gt;ViewPage&lt;/code&gt;, that looks similar to the Edit Page, but only let's a user see the content without being able to modify it. Useful if you want certain users to only view, yet not modify content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;filament&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="nc"&gt;YourModelName&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have to register the &lt;code&gt;ViewPage&lt;/code&gt; in the resources' &lt;code&gt;getPages()&lt;/code&gt; method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getPages&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'index'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Pages\ListUsers&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="s1"&gt;'create'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Pages\CreateUser&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/create'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="s1"&gt;'view'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Pages\ViewUser&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/{record}'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="s1"&gt;'edit'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Pages\EditUser&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/{record}/edit'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Now you should have a basic structure of you Filament Admin Panel! Setting up the basic core of your project requires just a few commands, from this point on you can customize and expand.&lt;/p&gt;

&lt;p&gt;There are endless possibilities on how you can actually use this package. For example, I'm working on a shift-organization tool, which after these initial steps only took a bit of tweaking to become fully functional in no time!&lt;/p&gt;

&lt;p&gt;Hope you enjoy!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;PS:&lt;/strong&gt; Filament has so much up its sleeve, so I will be making this a series! If you want to know more basics and tips, make sure to follow me!😁&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>laravel</category>
      <category>webdev</category>
      <category>filament</category>
    </item>
  </channel>
</rss>
