Skip to content

Instantly share code, notes, and snippets.

@shahednur
shahednur / laravel.js
Created February 9, 2019 05:58 — forked from JeffreyWay/laravel.js
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
in database:
$table->enum('fruit', ['apple', 'banana', 'cantalope']);
in controller's construct:
public function __construct()
{
DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
}
how to use this Enum in cotroller:
@shahednur
shahednur / Response.php
Created December 10, 2021 13:37 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@shahednur
shahednur / tailwind.config.js
Last active February 19, 2022 21:00
tailwind.config.js
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
@shahednur
shahednur / react-authentication-folder-structure.md
Created February 3, 2022 17:40 — forked from mksglu/react-authentication-folder-structure.md
React JS Authenatication Folder Structure

React JS Authenatication + REST API

Used Packages

  • React JS
  • Redux Thunk
  • Redux Form
  • Redux Logger
@shahednur
shahednur / User.php
Created August 22, 2022 05:26
Laravel Eloquent Model Accessor to get Client/User IP Address
public function getClientIps()
{
$clientIps = array();
$ip = $this->server->get('REMOTE_ADDR');
if (!$this->isFromTrustedProxy()) {
return array($ip);
}
if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
$forwardedHeader = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
preg_match_all('{(for)=("?\[?)([a-z0-9\.:_\-/]*)}', $forwardedHeader, $matches);
@shahednur
shahednur / movie-streaming-apps-activity.txt
Created September 3, 2023 15:43
Prompt: in a movie streaming flutter android app, which kind of activity a user can do, give that list of activity.
Prompt: what is the process of creating that movie streaming app's models using this activity list?
Creating models for a movie streaming app involves defining the data structures and relationships between different entities within the app. Based on the list of activities you provided, here's a step-by-step process for creating models for a movie streaming app:
1. **Identify Entities:**
Start by identifying the main entities (objects or data structures) that will be central to your app. In this case, key entities might include:
- User
- Movie/TV Show
- User Profile
- Review