<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by everton zp on Medium]]></title>
        <description><![CDATA[Stories by everton zp on Medium]]></description>
        <link>https://medium.com/@ezp127?source=rss-83ea8e70117d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XQCq44p62QPMa42jVs1huA.jpeg</url>
            <title>Stories by everton zp on Medium</title>
            <link>https://medium.com/@ezp127?source=rss-83ea8e70117d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 02:43:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ezp127/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Usando operadores lógicos na busca do Google]]></title>
            <link>https://medium.com/@ezp127/usando-operadores-l%C3%B3gicos-na-busca-do-google-58c46d5255b6?source=rss-83ea8e70117d------2</link>
            <guid isPermaLink="false">https://medium.com/p/58c46d5255b6</guid>
            <dc:creator><![CDATA[everton zp]]></dc:creator>
            <pubDate>Sat, 21 Jul 2018 14:56:31 GMT</pubDate>
            <atom:updated>2018-07-21T15:47:40.121Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*50OqvHo9i3bg53zwSaXTlA.jpeg" /></figure><h3>Usando operadores lógicos na busca do google</h3><p>Refine suas buscas no Google utilizando sequências de operadores lógicos para encontrar termos específicos.</p><p>Você vai precisar combinar apenas alguns parâmetros em conjunto com os operadores lógicos AND e OR.</p><p><strong>Os exemplos a seguir devem ser digitados na caixa de pesquisa do Google.</strong></p><h3>Parâmetros</h3><p>Os parâmetros tem a função de pesquisar em partes específicas do conteúdo; como o endereço do site, título e texto.</p><h4><strong>inurl</strong></h4><p>Busca pelo nome do site ou a palavra-chave presente no endereço do navegador.</p><p>Pode ser o endereço do site:</p><blockquote>inurl:empresa.com.br</blockquote><p>Ou apenas o nome da empresa:</p><blockquote>inurl:empresa</blockquote><h4><strong>site</strong></h4><p>Semelhante ao inurl, mas nesse caso deve ser informado um endereço de site válido.</p><blockquote>site:empresa.com.br</blockquote><h4><strong>intitle</strong></h4><p>A palavra-chave deve aparecer no título do resultado da busca.<br>Palavras simples:</p><blockquote>intitle:empresa</blockquote><p>Para termos com mais de uma palavra use aspas:</p><blockquote>intitle:”empresa xyz”</blockquote><h4><strong>intext</strong></h4><p>A palavra-chave deve aparecer no conteúdo do resultado da busca.</p><blockquote>intext:cnpj</blockquote><blockquote>intext:cep</blockquote><blockquote>intext:”nome da empresa”</blockquote><h3>Pesquisar múltiplos termos usando operadores lógicos</h3><h4>AND</h4><p>Busca os resultados que <strong>devem</strong> estar presentes em ambos os termos, antes E depois do operador. ‘<em>palavra-a’</em> <strong>AND</strong> ‘<em>palavra-b’</em>. O operador deve ser digitado em caixa alta.</p><blockquote>intext:empresa AND intext:cnpj</blockquote><blockquote>intitle:empresa AND intext:cnpj</blockquote><blockquote>inurl:empresa.com.br intext:empresa AND intext:cnpj</blockquote><h4>OR</h4><p>Busca os resultados que incluem <strong>qualquer um</strong> dos termos, antes OU depois do operador. ‘<em>palavra-a</em>’ <strong>OR</strong> ‘<em>palavra-b</em>’. O operador deve ser digitado em caixa alta.</p><blockquote>intext:cnpj OR intext:cpf</blockquote><blockquote>intitle:empresa intext:cnpj OR intext:cpf</blockquote><h4>Excluir um termo da busca:</h4><p>Utilize o símbolo “<strong>-</strong>” (hífen) em frente ao termo para omitir palavras semelhantes, mas não relacionadas a busca.</p><blockquote>”empresa xyz” -”empresa x”</blockquote><blockquote>site:empresaxyz.com.br -site:empresax.com.br</blockquote><blockquote>intitle:empresaxyz -intitle:empresax</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58c46d5255b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel 5.4 (and 5.5) native User Authentication + Role Authorization]]></title>
            <link>https://medium.com/@ezp127/laravel-5-4-native-user-authentication-role-authorization-3dbae4049c8a?source=rss-83ea8e70117d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dbae4049c8a</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel54]]></category>
            <dc:creator><![CDATA[everton zp]]></dc:creator>
            <pubDate>Thu, 30 Mar 2017 01:31:18 GMT</pubDate>
            <atom:updated>2020-02-08T03:27:15.754Z</atom:updated>
            <content:encoded><![CDATA[<p>A brief step-by-step of how to implement a native Laravel 5.4 user authentication + role authorization.</p><p><em>Disclaimer: This simple tutorial does not pretend to be the ultimate approach implementing ACL in your project. The main goal here is help you to grasp the very basics on this subject so after this first contact you can jump to a proper ACL library.</em></p><p>Starting from a <strong>fresh Laravel 5.4/5.5 installation,</strong> run the php artisan to create the Auth resource:</p><pre>$ php artisan make:auth</pre><p>Create the <strong><em>Role</em></strong> model and respective migration (-m parameter):</p><pre>$ php artisan make:model Role -m</pre><p>Edit <strong><em>CreateRolesTable</em></strong> class in the <em>migrations</em> folder:</p><pre>public function up()<br>{<br>  Schema::create(‘roles’, function (Blueprint $table) {<br>    $table-&gt;increments(‘id’);<br>    $table-&gt;string(‘name’);<br>    $table-&gt;string(‘description’);<br>    $table-&gt;timestamps();<br>  });<br>}</pre><pre>public function down()<br>{<br>  Schema::dropIfExists(‘roles’);<br>}</pre><p>Create a new migration for the <strong><em>role_user</em></strong> pivot table :</p><pre>$ php artisan make:migration create_role_user_table</pre><p>Edit <strong><em>CreateRoleUserTable</em></strong> class in the <em>migrations</em> folder:</p><pre>public function up()<br>{<br>  Schema::create(‘role_user’, function (Blueprint $table) {<br>    $table-&gt;increments(‘id’);<br>    $table-&gt;integer(‘role_id’)-&gt;unsigned();<br>    $table-&gt;integer(‘user_id’)-&gt;unsigned();<br>  });<br>}</pre><pre>public function down()<br>{<br>  Schema::dropIfExists(‘role_user’);<br>}</pre><p>Now let’s provide a many-to-many relationship between <strong>User</strong> and <strong>Role</strong>.</p><p>Open <strong><em>User</em></strong> model and add the following method:</p><pre>public function roles()<br>{<br>  return $this-&gt;belongsToMany(Role::class);<br>}</pre><p>Do the same with <strong><em>Role</em></strong> model:</p><pre>public function users()<br>{<br>  return $this-&gt;belongsToMany(User::class);<br>}</pre><p>It’s time to create some seeders to add roles and users in the database:</p><pre>$ php artisan make:seeder RoleTableSeeder</pre><pre>$ php artisan make:seeder UserTableSeeder</pre><p>Edit <strong><em>RoleTableSeeder</em></strong> class (database/seeds/ folder) adding the following code in <strong><em>run()</em></strong> method:</p><pre>use Illuminate\Database\Seeder;<br><strong>use App\Role;</strong></pre><pre>class RoleTableSeeder extends Seeder<br>{<br>  public function run()<br>  {<br>    $role_employee = new Role();<br>    $role_employee-&gt;name = ‘employee’;<br>    $role_employee-&gt;description = ‘A Employee User’;<br>    $role_employee-&gt;save();</pre><pre>    $role_manager = new Role();<br>    $role_manager-&gt;name = ‘manager’;<br>    $role_manager-&gt;description = ‘A Manager User’;<br>    $role_manager-&gt;save();<br>  }<br>}</pre><p>Do the same with <strong><em>UserTableSeeder</em></strong> class:</p><pre>use Illuminate\Database\Seeder;<br><strong>use App\User;<br>use App\Role;</strong></pre><pre>class UserTableSeeder extends Seeder<br>{<br>  public function run()<br>  {<br>    <strong>$role_employee</strong> = Role::where(‘name’, ‘employee’)-&gt;first();<br>    <strong>$role_manager</strong>  = Role::where(‘name’, ‘manager’)-&gt;first();</pre><pre>    $employee = new User();<br>    $employee-&gt;name = ‘Employee Name’;<br>    $employee-&gt;email = ‘<a href="/service/mailto:user@componeto.com.br">employee@example.com</a>’;<br>    $employee-&gt;password = bcrypt(‘secret’);<br>    $employee-&gt;save();<br>    <strong>$employee-&gt;roles()-&gt;attach($role_employee);</strong></pre><pre>    $manager = new User();<br>    $manager-&gt;name = ‘Manager Name’;<br>    $manager-&gt;email = ‘<a href="/service/mailto:manager@componeto.com.br">manager@example.com</a>’;<br>    $manager-&gt;password = bcrypt(‘secret’);<br>    $manager-&gt;save();<br>    <strong>$manager-&gt;roles()-&gt;attach($role_manager);</strong><br>  }<br>}</pre><p>Edit <strong><em>DatabaseSeeder</em></strong> class (<em>database/seeds/</em> folder) adding the following code in <strong><em>run()</em></strong> method:</p><pre>public function run()<br>{<br>  // Role comes before User seeder here.<br>  <strong>$this-&gt;call(RoleTableSeeder::class);</strong><br>  // User seeder will use the roles above created.<br>  <strong>$this-&gt;call(UserTableSeeder::class);</strong><br>}</pre><p>Almost done! Don’t give up! ^^</p><p>Open <strong><em>User</em></strong> model and add these three tiny methods:</p><pre>/**</pre><pre>* @param string|array $roles</pre><pre>*/</pre><pre>public function authorizeRoles($roles)</pre><pre>{</pre><pre>  if (is_array($roles)) {</pre><pre>      return $this-&gt;hasAnyRole($roles) || <br>             abort(401, &#39;This action is unauthorized.&#39;);</pre><pre>  }</pre><pre>  return $this-&gt;hasRole($roles) || <br>         abort(401, &#39;This action is unauthorized.&#39;);</pre><pre>}</pre><pre>/**</pre><pre>* Check multiple roles</pre><pre>* @param array $roles</pre><pre>*/</pre><pre>public function hasAnyRole($roles)</pre><pre>{</pre><pre>  return null !== $this-&gt;roles()-&gt;whereIn(‘name’, $roles)-&gt;first();</pre><pre>}</pre><pre>/**</pre><pre>* Check one role</pre><pre>* @param string $role</pre><pre>*/</pre><pre>public function hasRole($role)</pre><pre>{</pre><pre>  return null !== $this-&gt;roles()-&gt;where(‘name’, $role)-&gt;first();</pre><pre>}</pre><p>Open app/Http/Controllers/Auth/<strong>RegisterController.php</strong> and change the <strong>create()</strong> method to set a default Role for new Users:</p><pre><strong>use App\Role;</strong></pre><pre>class RegisterController ...</pre><pre>protected function create(array $data)<br>  {<br>    <strong>$user = User::create([<br>      &#39;name&#39;     =&gt; $data[&#39;name&#39;],<br>      &#39;email&#39;    =&gt; $data[&#39;email&#39;],<br>      &#39;password&#39; =&gt; bcrypt($data[&#39;password&#39;]),<br>    ]);</strong><br>    <strong>$user<br>       -&gt;roles()<br>       -&gt;attach(Role::where(&#39;name&#39;, &#39;employee&#39;)-&gt;first());</strong></pre><pre>    <strong>return $user;</strong><br>}</pre><p>Run the migrate command with seed parameter. Next time you login, each user should have a role.</p><pre>$ php artisan migrate:fresh --seed</pre><p><strong>Finally the final step!</strong> Now, all you need to do is call the User <em>authorizeRoles()</em> method inside your Controller Actions or Middlewares and pass an array with the user roles you want to grant access.</p><pre>class HomeController extends Controller<br>{<br>  public function __construct()<br>  {<br>    <strong>$this-&gt;middleware(&#39;auth&#39;);</strong><br>  }</pre><pre>  public function index(<strong>Request $request</strong>)<br>  {<br>    <strong>$request-&gt;user()-&gt;authorizeRoles([&#39;employee&#39;, &#39;manager&#39;]);</strong></pre><pre>    return view(‘home’);<br>  }</pre><pre>  /*<br>  <em>public function someAdminStuff(Request $request)<br>  {<br>    $request-&gt;user()-&gt;authorizeRoles(&#39;manager&#39;);</em></pre><pre><em>    return view(‘some.view’);<br>  }</em><br>  */</pre><pre>}</pre><p>After this point, just proceed with the normal development flow. Build a interface CRUD to manage roles and assign them to the users.</p><p><em>Credits: This article is inspired by </em><a href="https://www.youtube.com/watch?v=Kas2w2DBuFg"><em>this</em></a><em> Academind video series.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dbae4049c8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>